multidimensional array and storing locations of values
Posted: Sun Feb 07, 2010 12:41 pm
I have an object which creates a multidimensional array. I would like to be able to store the locations of the values in a separate array. Kinda like a road map of the original array, so when I update via JSON my script will know where to look for the specified value inside of the updated array.
$array = ['first'][1]['second'][0]['item'] = 'some item to be updated';
What I need to store is the ['first'][1]['second'][0]['item'] which is the location of 'some value to be updated';
Ideally after my array is completed I would like to be able to loop through it and store the location of each value like above.
Any ideas or suggestions would be appreciated.
Edit: also what would be the best way to store the location, Im assuming a string.
$array = ['first'][1]['second'][0]['item'] = 'some item to be updated';
What I need to store is the ['first'][1]['second'][0]['item'] which is the location of 'some value to be updated';
Ideally after my array is completed I would like to be able to loop through it and store the location of each value like above.
Any ideas or suggestions would be appreciated.
Edit: also what would be the best way to store the location, Im assuming a string.