$tpl = [
"a",
"b",
"c",
"d",
];
$value = "hello";
- how to generate the following in code?
$arr["a"]["b"]["c"]["d"] = $value;
$tpl = [
"a",
"b",
"c",
"d",
];
$value = "hello";
$arr["a"]["b"]["c"]["d"] = $value;
$tpl = array_reverse($tpl);
$arr = $value;
foreach($tpl as $k) {
$arr = [$k => $arr];
}
print_r($arr);
$tpl = [ a , b , c , d , ]; $value = hello ; how to generate the following in code? $arr[ a ][ b ][ c ][ d ] = $value; ...
$tpl = [ a , b , c , d , ]; $value = hello ; how to generate the following in code? $arr[ a ][ b ][ c ][ d ] = $value; ...
$tpl = [ a , b , c , d , ]; $value = hello ; how to generate the following in code? $arr[ a ][ b ][ c ][ d ] = $value; ...