
I am not able to figure out why my condition is not working while the ip address is in the array. Why condition is failing as shown in image
<?php $valid_ip_list = explode(',',$this->valid_ips);
echo $client_ip = $_SERVER['REMOTE_ADDR'];
print('<pre>');
print_r($valid_ip_list);
if(in_array($client_ip ,$valid_ip_list))
{
echo 'I am here';
}
else
{
echo 'Condition fail';
}
?>
Problem solved with the help of array_map('trim', explode(',', $valid_ips))
strlen($this->valid_ips[2])give you? Or better, changeprint_rtovar_dumpand post the results.