In PHP, is it possible to post an empty string as an array key, based on the input name?

Viewed 62

The following input will produce $_POST['test']['a'] === "1"

<input name="test[a]" value="1">

The following input will produce $_POST['test'][0] === "2"

<input name="test[]" value="2">

The following input will produce $_POST['test'][0] === "3"

<input name="test[ ]" value="3"> <!-- space in between the [ ] -->

The following input will produce $_POST['test'][' '] === "4"

<input name="test[ ]" value="4"> <!-- two spaces in between the [  ] -->

(I expected white space was ignored or it wasn't, but the examples 3 and 4 shows that only one space is ignored.. more than that will cause all spaces to be accepted).

The following input will produce $_POST['test']["''"] === "5" (note this is a string containing two single quotation marks, this key is not an empty string).

<input name="test['']" value="5">

Is there some possible syntax that will produce $_POST['test'][''] === "4" from a pure HTML input posted to PHP?

0 Answers
Related