开发者

remove key from associative array with single key

I have the following array,

$myarray[0]['first_name']
$myarray[0]['last_name']

I want to turn it into:

$myarray开发者_StackOverflow社区['first_name']
$myarray['last_name']

with a simple oneliner?


this?

$myarray = $myarray[0];


Or this?

$myarray = current($myarray);

user187291's solution still looks clearer though.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜