[eluser]agammill[/eluser]
I have an array where I need one column in the array formatted in a certain way.
So I successfully created a second array, based on a column in the first array but I’m having trouble adding the new column back into the first array.
merge_array and push array are placing the data AFTER the first array and not as another column in the first array.
Code:
$matches = $this->my_model->getRandom(); //this is the first array
foreach ($matches as $tag){
$display_tag[] = $qtag->display_tag($tag['tag_string']);
}//second array for new column
print_r(array_merge($matches, $display_tag));
I’d like the new column to have the key name 'tag_display' but when I add it to the array like this:
Code:
foreach ($matches as $tag){
$display_tag['tag_display'] = $qtag->display_tag($tag['tag_string']);
}
but this only displays the last element.