I tried the entire afternoon, but just cannot figure how to get this done.
<?php
$e['ea'] = '01';
$e['eb'] = '02';
$e['ec'] = '03';
$a = array(
'e' => $e,
'h'=>'ec',
'p'=>[
'in' => [
['in' => '01'],
['in' => '02'],
['in' => '03']
]
]
);
$i['ia'] = '04';
$i['ib'] = '04';
$i['ic'] = '04';
$path = '$a[\'e\'][\'ed\']';
${'path'} = $i; //Here is where I'm stuck
echo '<pre>';
print_r($a);
echo '</pre>';
?>
I have the path to a key stored as $path
, that I'm trying to use to assign the value of $i
.
But it somehow won't work. How can I achieve this?