Re: in_array w/statement

From: Date: Thu, 16 Dec 2004 21:21:58 +0000
Subject: Re: in_array w/statement
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-204538@lists.php.net to get a copy of this message
> 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. you could add the is_array() check. > $buddylist = preg_split('/( )+/', trim($userinfo['buddylist']), -1, > PREG_SPLIT_NO_EMPTY); > > if($buddylist) > { > $buddy = in_array($uname['uid'], array(implode(',', $buddylist))); > } not sure I understand this, implode returns a string, then you are putting that string into the array() function. I dont know what kind of data you would get back from that. $buddylist should already be an array.

« previous php.general (#204538) next »