虽然这种方法运作得很好,但我很好奇是否有人知道这样做的更漂亮的方法,因为这种情况似乎经常出现。
<?php
//Initialy, data is nested up in $some_array[0] ...
$some_array = array(array('somevar' => "someValue", "someOtherVar" => "someOtherValue"));
print_r($some_array);
数组([0] =&gt;数组([somevar] =&gt; someValue [someOtherVar] =&gt; someOtherValue))
// Could the following line be achieved a more elegant fashion?
$some_array = $some_array[0];
print_r($some_array);
// Prints the intended result:
数组([somevar] =&gt; someValue [someOtherVar] =&gt; someOtherValue)
有没有人知道如何通过本机功能或更优雅的方式实现这一目标?
谢谢!