Code: Select all
<input type="text" name="address[primary][address]" />
<input type="text" name="address[primary][postalCode]" />
<input type="text" name="address[primary][city]" />
<input type="text" name="name" />
<input type="text" name="country" />
My function
Code: Select all
public function test()
{
$args = func_get_args();
$field = '_POST';
foreach ($args as $arg)
{
$field .= '["'.$arg.'"]';
}
dump($_POST["addresses"]["primary"]["address"]);
dump($field);
dump(${$field});
die();
}
[text]
--> one //this is correct
--> _POST["addresses"]["primary"]["address"] //this is also correct
--> Notice: Undefined variable: _POST["addresses"]["primary"]["address"]..... //this is NOT correct. This variable obviously does exist!
[/text]
So, does anyone know how to get this to work properly or maybe there is a better way to go about doing this instead of crazy variable variables?