array search

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Hello All,

  I've been trying for days now to make this work.
I'm trying to search my array for a value and return the key.
I get the visitor's IP and try this  -- this is the latest,
I've tried a few functions to echo the name associated with the viz_ip.


$viz_ip= $_SERVER['REMOTE_ADDR'];

$byte_ip= array(

"204.126.202.56"=>"Mark",

"63.230.76.166"=>"Bob",

"63.220.76.165"=>"John",
);

function _array_search ($viz_ip, $byte_ip) {

   foreach($byte_ip as $key => $val) {

       if ($viz_ip === $key) {
           return($val);
       }

   }

   return(False);
   }


I'm no wiz but this shouldn't be this hard, maybe I'm thinking wrong. I've read the examples at php.net but I just can't get it. Some help or even a hint ?

best regards,
malcolm


-- Ommmm

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux