NYCPHP Meetup

NYPHP.org

[nycphp-talk] problems with in_array

Phil Powell soazine at erols.com
Thu Jul 31 12:52:14 EDT 2003


$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




More information about the talk mailing list