Here i have an array
Array
(
[0] => stdClass Object
(
[gallery_id] => 25
[title] => Our Job is Your Vacation
[image_path] => 1.png
)
[1] => stdClass Object
(
[gallery_id] => 25
[title] => Our Job is Your Vacation
[image_path] => 2.png
)
[2] => stdClass Object
(
[gallery_id] => 25
[title] => Our Job is Your Vacation
[image_path] => 3.jpg
)
[3] => stdClass Object
(
[gallery_id] => 26
[title] => enjoy vacation
[image_path] => 1.jpg
)
[4] => stdClass Object
(
[gallery_id] => 26
[title] => enjoy vacation
[image_path] => 2.jpg
)
)
Expected array to be
Array
(
[0] => stdClass Object
(
[gallery_id] => 25
[title] => Our Job is Your Vacation
[image_path] => array{
'1.png',
'2.png',
'3.png'
}
)
[1] => stdClass Object
(
[gallery_id] => 26
[title] => enjoy vacation
[image_path] => array{
'1.jpg',
'2.jpg'
}
)
}
How can i get this, could anyone help me out.
EDIT Below are the table structures
table1 - gallery
**gallery_id** **title**
'25' 'Our Job is Your Vacation'
'26' 'enjoy vacation'
table2 - gallery_images
**id** **gallery_id** **image_path**
1 '25' '1.png'
2 '25' '2.png'
3 '25' '3.png'
4 '26' '1.jpg'
5 '26' '2.jpg'