Re: array search

From: Date: Sun, 23 Jan 2005 16:33:16 +0000
Subject: Re: array search
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-207088@lists.php.net to get a copy of this message
> I've been trying for days now to make this work. This worked for me (with my IP address for 'John'): <?php $viz_ip= $_SERVER['REMOTE_ADDR']; echo ("Your IP is $viz_ip"); $byte_ip= array( "204.126.202.56"=>"Mark", "63.230.76.166"=>"Bob", "84.196.101.86"=>"John", ); function _array_search ($viz_ip, $byte_ip) { foreach($byte_ip as $key => $val) { if ($viz_ip === $key) { return($val); } } return(False); } ?> <p>Hi <?php echo (_array_search($viz_ip, $byte_ip)); ?></p> J

« previous php.general (#207088) next »