<input type="text" name="ip[]"/>
<?php
$ip = $_POST['ip'];
if(filter_var($ip, FILTER_VALIDATE_IP)) {
echo("$ip is a valid IP address");
}else {
echo("$ip is not a valid IP address");
}
?>
If I put any ip without being an array inside the variable that receives my ip and validates quietly, but when I pass an array, since the input field is dynamic, php does not accept the validation.
I've tried using FILTER_REQUIRE_ARRAY, but it did not work.