Need to create a multidimensional array by matching the keys in an array.
array 1:
[
'slide_name_1' => 'lorem ipsum',
'slide_title_1' => 'lorem ipsum',
'slide_name_2' => 'lorem ipsum',
'slide_title_2' => 'lorem ipsum',
]
I need to create this:
[0] => array (
'slide_name_1' => 'lorem ipsum 1',
'slide_title_1' => 'lorem ipsum 1',
)
[1] => array (
'slide_name_2' => 'lorem ipsum 2',
'slide_title_2' => 'lorem ipsum 2',
)
I was thinking of running some nested foreach loops and matching just the number portion of the keys (ex: substr($key, strrpos($key, '_') + 1);).
Of course this has proven to be more difficult than i had anticipated. Any suggestions would be greatly appreciated.
strrpos?explode('_', $key)and then use the last element of that.array_chunk