Re: Re: parse_str()
| From: | Rasmus Lerdorf | Date: | Wed, 02 Apr 2003 22:53:44 +0000 |
| Subject: | Re: Re: parse_str() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-142035@lists.php.net to get a copy of this message | ||
> "Jose" <php_mailing_list@sonnd.co.uk> wrote in message
> news:000301c2f7f4$a3656f90$0100a8c0@YAL...
> I might be wrong here, but with the code below I would expect $_GET to be
> filled and the script to output the next line:
>
> <?php
> $example_string = 'action=kick&item=me';
> parse_str($example_string);
> var_dump($_GET);
> ?>
>
> // expected output:
> //
> // array(2) { ["action"]=> string(4) "kick" ["item"]=>
> string(2) "me" }
> //
>
> Is my assumption wrong? What would be the workaround?
Your assumption is way wrong. $_GET will only contain data that actually
passed through a GET-method request. Decoding a URL-encoded string
doesn't suddenly make it GET data. It will simply create entries in your
global symbol table, or alternatively you can pass a second argument which
is an array it will put the data into. As per the docs.
-Rasmus