Look I have a form like this:
<form method="post">
<input name="variable[var1][var2]" value="44"/>
</form>
I want to get the value of variable[var1][var2]
in PHP using a string like:
$str = "['variable']['var1']['var2']";
echo "{$_POST{$str}}";
Why I need to do that?
I need it because the code that gets the value is totally dynamic and I cannot get or set manually the value using $_POST['variable']['var1']['var2']
.
Can you help?
NOTE: I know this is possible to get it using $_POST['variable']['var1']['var2']
, please don't ask me about why I'm not using this way. Simply I need to use as above (using $str
).