On Friday 17 December 2004 02:33, Sebastian wrote: > I cannot solve this problem,. sorry if this looks confusing,. It is ... > i have a form and don't want to set the variable if the in_array is true.. > the code works, up until i add the last !$buddy in the statement, for some > reason it seems to always be true, ... something i'm doing wrong? btw, i > cannot add the in_array to the statement because if the $buddylist is empty > it will generate errors because of the empty implode. > > $buddylist = preg_split('/( )+/', trim($userinfo['buddylist']), -1, > PREG_SPLIT_NO_EMPTY); OK, it looks like $userinfo['buddylist'] is a string containing buddies separated by some whitespace: 'buddy1 buddy2' After the above statement $buddylist becomes an array. > if($buddylist) > { > $buddy = in_array($uname['uid'], array(implode(',', $buddylist))); > } Here implode() returns a string containing 'buddy1,buddy2', then you stick that into an array() which is effectively: array('buddy1,buddy2'); // note that there is only *1* element Now unless your $uname['uid'] really is literally 'buddy1,buddy2' then $buddy will be false. Hope that's enough to get you going. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* The moon is made of green cheese. -- John Heywood */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php