For some reason, I'm struggling with this.
I have the following 2 arrays, and I need to take the values โโof the array from the $ img array and insert them in order into the $ text array, adding / replacing the% img_ tags, for example:
$text = array(
0 => "Bunch of text %img_ %img_: Some more text blabla %img_",
1 => "More text %img_ blabla %img_"
);
$img = array("BLACK","GREEN","BLUE", "RED", "PINK");
I want my text array to end like this:
$text = array(
0 => "Bunch of text %img_BLACK %img_GREEN: Some moretext blabla %img_BLUE",
1 => "More text %img_RED blabla %img_PINK"
);
NOTE. The number of elements in the $ img array will vary, but will always match the number of% img_ in the $ text array.
source
share