Anything wrong with "in_array"
| From: | (Yang) | Date: | Mon, 21 Jul 2003 11:17:19 +0000 |
| Subject: | Anything wrong with "in_array" | ||
| Groups: | php.soap | ||
| Request: | Send a blank email to php-soap+get-862@lists.php.net to get a copy of this message | ||
function characterData($parser, $data) {
global $item;
global $returnedArray;
$data= trim($data);
if($item){
// echo var_dump($data);
//echo var_dump($returnedArray);
if(!in_array($data,$returnedArray)){
$returnedArray[]=$data;
}
}
}
As above , I try to use in_array to avoid duplication. It works vell on my
own machine which runs PHP HOME version. However, when I run it on
University machine(php4.1.2), a warning is give:
Warning: Wrong datatype for second argument in call to in_array in
/home/yang/test/1.php on line 33
Auckland
Beijing
Berlin
Birmingham
Chicago
Darwin
Dublin
Edmonton
Hong Kong
London
Manchester
Melbourne
Moscow
New York
Newcastle
Oslo
Ottawa
San Diego
San Francisco
Seattle
Shanghai
Sydney
Tokyo
So, is there anything wrong with in_array I used?
Cheers!
Yang