RE: [SOAP] Anything wrong with "in_array"
| From: | Alok K. Dhir | Date: | Mon, 21 Jul 2003 14:17:58 +0000 |
| Subject: | RE: [SOAP] Anything wrong with "in_array" | ||
| References: | 1 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-863@lists.php.net to get a copy of this message | ||
You try something like:
if (is_array($returnedArray) && !in_array($data,$returnedArray))
Al
> -----Original Message-----
> From: Yang [mailto:Yuan.Yang@ncl.ac.uk]
> Sent: Monday, July 21, 2003 7:17 AM
> To: soap@lists.php.net
> Subject: [SOAP] Anything wrong with "in_array"
>
>
> 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
>
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>