note 125208 deleted from reserved.variables.get by salathe
| From: | salathe@php.net | Date: | Mon, 21 Sep 2020 14:47:49 +0000 |
| Subject: | note 125208 deleted from reserved.variables.get by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215314@lists.php.net to get a copy of this message | ||
Note Submitter: JagoMF
----
If you want $_GET to read a queryParam as an array, you need to suffix your key with '[]',
otherwise it will be read as a regular variable:
BAD:
if url: ...?myarray=val1&myarray=val2&myarray=val3
then $_GET: array( 'myarray' => 'val3' );
GOOD:
if url: ...?myarray[]=val1&myarray[]=val2&myarray[]=val3
then $_GET: array( 'myarray' => array('val1', 'val2',
'val3') );