in_array w/statement

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

 



Hi,
I cannot solve this problem,. sorry if this looks confusing,.
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);

if($buddylist)
{
 $buddy = in_array($uname['uid'], array(implode(',', $buddylist)));
}

if(($uname['uid'] == $ret) || ($uname['uname'] == $recipients2) &&
($uname['uid'] != 11) && !$buddy)
{
 $contactoptions = '<option value="'.$uname['uname'].'"
selected>'.$uname['uname'].'</option>';
}
else if(($uname['uid'] != $bbuserinfo['userid']) && ($uname['uid'] != 11) &&
!$buddy)
{
 $contactoptions .= '<option
value="'.$uname['uname'].'">'.$uname['uname'].'</option>';
}

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