I have array like that
$arr = [
'baz' => [
'foo' => [
'boo' => 'whatever'
]
]
];
Is there anyway to unset ['boo'] value using string input?
Something like that
$str = 'baz->foo->boo';
function array_unset($str, $arr) {
// magic here
unset($arr['baz']['foo']['boo']);
return $arr;
}
This answer was awesome, and it's made first part of my script run Using a string path to set nested array data . But It's can't reverse. P.S. eval() is not an option :(