NYCPHP Meetup

NYPHP.org

[nycphp-talk] problems with in_array

Phil Powell soazine at erols.com
Thu Jul 31 13:14:17 EDT 2003


Yes, it works now, apparently there was some latent caching issues going on
behind the scenes that I didn't catch.

Phil
----- Original Message -----
From: "Chris Shiflett" <shiflett at php.net>
To: "NYPHP Talk" <talk at lists.nyphp.org>
Sent: Thursday, July 31, 2003 1:08 PM
Subject: Re: [nycphp-talk] problems with in_array


> I hope you don't mind if I rewrite your code a little bit to simplify it
and
> try to see if I understand the question correctly.
>
> $get_array = array('foo', 'bar');
> foreach ($_GET as $get_name => $get_val)
> {
>      $in_array = in_array($get_name, $get_array);
>      echo "$get_name $in_array<br />";
>
>      if (!in_array($get_name, $get_array))
>      {
>           $form_array[] = $get_name;
>           echo "hidden form field for $get_name";
>      }
> }
>
> So, you are saying that when you pass a URL variable named foo, you will
see
> output such as this:
>
> foo 1<br />
> hidden form field for foo
>
> Right? If so, you're right that it doesn't make any sense, but I might be
> misinterpreting your question.
>
> Chris
> _______________________________________________
> talk mailing list
> talk at lists.nyphp.org
> http://lists.nyphp.org/mailman/listinfo/talk




More information about the talk mailing list