NYCPHP Meetup

NYPHP.org

[nycphp-talk] problems with in_array

Jon Baer jonbaer at jonbaer.net
Thu Jul 31 13:19:38 EDT 2003


seems to work fine if you do declare $formQSDupArray = array();  before the
loop ...

- jon

pgp key: http://www.jonbaer.net/jonbaer.asc
fingerprint: F438 A47E C45E 8B27 F68C 1F9B 41DB DB8B 9A0C AF47


----- Original Message ----- 
From: "Phil Powell" <soazine at erols.com>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Thursday, July 31, 2003 9:52 AM
Subject: [nycphp-talk] problems with in_array


> $cmaExceptionArray = array('hasPassedCookie', 'username', 'password',
> 'uniqueCMAKey', 'submit',
>                              'errorMsg');
> ...
> foreach ($HTTP_GET_VARS as $key => $val) {
>    echo $key . "&nbsp;" . in_array($key, $cmaExceptionArray) . "<BR>";
>    if (!in_array($key, $cmaExceptionArray)) {
>     array_push($formQSDupArray, $key); // ADD HERE BEFORE YOU GO TO FORM
> PART
>     echo "<input type=hidden name=$key value=\"" . htmlentities($val) .
> "\">\n";
>    }
>   }
>
> For some bizarre reason, if my query string has the key of "errorMsg", in
> spite of it being in cmaExceptionArray AND in spite of the fact that it
does
> produce the correct in_array value of "1", it still does the "echo"
portion
> when, in fact, it should not.
>
> If someone were to look at this and tell me what in blazes I did wrong, it
> escapes me.  As it always does :(
>
> Phil
>
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk
>




More information about the talk mailing list