I have data array like
$data = [
'name' => [
(int) 0 => '095a108478345cac184f956b1e8dee91a5a89f87bbabd7b3fb4058f577adf.jpg',
(int) 1 => '02059.jpg',
(int) 2 => 'avatar.jpg'
],
'type' => [
(int) 0 => 'image/jpeg',
(int) 1 => 'image/jpeg',
(int) 2 => 'image/jpeg'
],
'tmp_name' => [
(int) 0 => 'C:\xampp\tmp\php17AA.tmp',
(int) 1 => 'C:\xampp\tmp\php17BA.tmp',
(int) 2 => 'C:\xampp\tmp\php17BB.tmp'
],
'error' => [
(int) 0 => (int) 0,
(int) 1 => (int) 0,
(int) 2 => (int) 0
],
'size' => [
(int) 0 => (int) 80542,
(int) 1 => (int) 6532,
(int) 2 => (int) 6879
]
]
And i need convert to array like this
$data = [
(int) 0 => [
'name' => '095a108478345cac184f956b1e8dee91a5a89f87bbabd7b3fb4058f577adf.jpg',
'type' => 'image/jpeg',
'tmp_name' => 'C:\xampp\tmp\php17AA.tmp',
'error' => (int) 0,
'size' => (int) 80542
],
(int) 1 => [
'name' => '02059.jpg',
'type' => 'image/jpeg',
'tmp_name' => 'C:\xampp\tmp\php17BA.tmp',
'error' => (int) 0,
'size' => (int) 6532
],
(int) 2 => [
'name' => 'avatar.jpg',
'type' => 'image/jpeg',
'tmp_name' => 'C:\xampp\tmp\php17BB.tmp',
'error' => (int) 0,
'size' => (int) 6879
]
]
I'm looking for the correct way to convert the first php array to the second. Is there any of the PHP array functions provided for these actions. Either is possible with CakePHP hash Array management?
Yes, I can make a few foreach loops and create an array what I need, but I'm not sure if there is a more elegant way.