in_array not working explode
<p><img src="http://i.stack.imgur.com/rURln.png" alt="enter image description here"></p>

<p>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 </p>

<pre><code>&lt;?php $valid_ip_list = explode(',',$this-&gt;valid_ips);
           echo $client_ip = $_SERVER['REMOTE_ADDR'];
           print('&lt;pre&gt;');
           print_r($valid_ip_list);
            if(in_array($client_ip ,$valid_ip_list))
                {
                    echo 'I am here';
                }
           else
                {
                    echo 'Condition fail';
                }
?&gt;
</code></pre>

<p>Problem solved with the help of <code>array_map('trim', explode(',', $valid_ips))</code></p>
