I have the ‘path’ to an array value stored in a variable, and I am trying to set the value. What I am trying to do is this:
$array['Breaks'][1]['In'] = "XXX";
However, I have ['Breaks'][1]['In'] stored in a variable. So I am essentially trying to do something like this:
$path = "['Breaks'][1]['In']";
$array.$path = "XXX";
This doesn’t work though, and I’m not exactly sure how to go about making this work correctly.
Any suggestions?
Try doing this,
Demo