I have a multidimensional array like this
Array =>
[0] => Array
(
[address] => Zaa 6
[category_ids] => Array
(
[0] => 100
[1] => 101
)
[category_labels] => Array
(
[0] => Array
(
[0] => value1
[1] => value2
[2] => value3
[3] => value4
)
[1] => Array
(
[0] => value5
[1] => value6
[2] => value7
)
)
[city] => gg
[lat] => 37.964652
[lng] => 23.708208
[name] => New Place
[1]=> Array the same as above
Every array is a record.
And I want to put all the elements in a mysql database. But in the column category_ids I want to insert "100, 101" and in category_labels I want to put only the last values of each array such as "value4, value7". How can I do this?
I know that I can use end()
, count()
and implode()
but I don't know how exactly.