I need to find one value in an multidimensional array, replace it. This will need to be done three 10 times or so.
Is there anyway of getting a reference to the key that I change so that after the first change has been made I no longer need to walk the array again? The arrays are always the same, I'm just looking through them, replacing one value and that's it. If I know the complete array path to the key changed I can just change this the other 9 times instead of using array_walk_recursive again.
associative, the problem is that there are keys with the same name.
My array looksl ike this
imgConfig = array {
'file' = 'GIFBUILDER'
'file.' = array (
XY = '600,137'
format = 'jpg'
quality = '80'
'10' = 'IMAGE'
'10.' = array (
'file' = '%i'
}
'20' = BOX
'20.' = array (
'dimensions' = '0,70,600,50'
'opacity' = '50'
}
'30' = 'IMAGE'
'30'. = array (
'file' = '{$pathV3}images/reports/frame.png'
'mask' = '{$pathV3}images/reports/frame_mask.png'
}
}
}
There could also be more keys and sub arrays in the future.
I want to replace %i in '10.' This could also change, it is 10 now but could be 20. or 40. in the future.
So instead of having to replace %i for each loop that I make through my reports, I could just do it once, then some how track the key's position in the array and just replace that on all following loops.
Is there anyway of getting a reference to the key that I change so that after the first change has been made I no longer need to walk the array again? The arrays are always the same, I'm just looking through them, replacing one value and that's it. If I know the complete array path to the key changed I can just change this the other 9 times instead of using array_walk_recursive again.
associative, the problem is that there are keys with the same name.
My array looksl ike this
imgConfig = array {
'file' = 'GIFBUILDER'
'file.' = array (
XY = '600,137'
format = 'jpg'
quality = '80'
'10' = 'IMAGE'
'10.' = array (
'file' = '%i'
}
'20' = BOX
'20.' = array (
'dimensions' = '0,70,600,50'
'opacity' = '50'
}
'30' = 'IMAGE'
'30'. = array (
'file' = '{$pathV3}images/reports/frame.png'
'mask' = '{$pathV3}images/reports/frame_mask.png'
}
}
}
There could also be more keys and sub arrays in the future.
I want to replace %i in '10.' This could also change, it is 10 now but could be 20. or 40. in the future.
So instead of having to replace %i for each loop that I make through my reports, I could just do it once, then some how track the key's position in the array and just replace that on all following loops.