PHP built in array function
Lets say I end up with an array like such:
Array ( [0] => Array ( [0] => user
[1] => pass
)
)
may开发者_运维百科be as a result of passing an array through a function and using func_get_args()
In this case, I would want to get rid of the initial array, so I just end up with:
Array ( [0] => user
[1] => pass
)
I know I could make a function to accomplish this, and push each element into a new array, however, is there some built in functionality with PHP that can pull this off?
$new_array = $old_array[0];
...
array_pop()
will pop the last (first, if only 1 is present) element.
Just take the value of the first element of the "outer" array.
I would recommend array_shift as it removes and returns the first element off of the beginning of the array.
精彩评论