This is my response:
Array
(
[0] => Array
(
[1] => Array
(
[aid] => 1
[address] => Surat
[country] => India
[state] => Gujarat
[city] => Surat
[pincode] => 395010
[full_name] => Pra test
[mobile_no] => 7984509142
[email] =>
[default] => 0
)
)
)
I want response like:
Array
(
[1] => Array
(
[aid] => 1
[address] => Surat
[country] => India
[state] => Gujarat
[city] => Surat
[pincode] => 395010
[full_name] => Pra test
[mobile_no] => 7984509142
[email] =>
[default] => 0
)
)
I want to remove 0 index from my response. I want my response like what I define below. so how can I do this with functions and etc..
4
Answers
I use array_replace_recursive() function and get response I want.
now my response is :
It sounds like you are trying to remove an extra layer from a multi-dimentional array.
An easy way would be something like:
Edit:
Per @Gert B’s suggestion:
To return the first element regardless of the key:
The reset function returns the pointer to the beginning of the array, and more importantly for this question, returns the first element of the array.
Try this,
This was the easiest way …