PHP-如何动态导航此数组

PHP-如何动态导航此数组,php,arrays,Php,Arrays,以下数组存在问题。。。我无法使用$arrayname[0]导航它。。。它必须是$arrayname[111]。。。有没有一种方法可以让这成为第一种方法?第一个数字是动态的 array(1) { [111]=> object(stdClass)#202 (24) { ["ID"]=> int(111) ["post_author"]=> string(1)"2" ["post_date"]=> string(19) "2011-03-18 14:3

以下数组存在问题。。。我无法使用$arrayname[0]导航它。。。它必须是$arrayname[111]。。。有没有一种方法可以让这成为第一种方法?第一个数字是动态的

array(1) { [111]=> object(stdClass)#202 (24) { 
    ["ID"]=> int(111)
    ["post_author"]=> string(1)"2"
    ["post_date"]=> string(19) "2011-03-18 14:36:08"
    ["post_date_gmt"]=> string(19) "2011-03-18 18:36:08"
    ["post_content"]=> string(0) ""
    ["post_title"]=> string(23) "Kyle Hotchkiss' Mugshot"
    ["post_excerpt"]=> string(0) ""
    ["post_status"]=> string(7) "inherit"
    ["comment_status"]=> string(4) "open"
    ["ping_status"]=> string(4) "open" ["post_password"]=> string(0) ""
    ["post_name"]=> string(18) "mugshot_khotchkiss" ["to_ping"]=> string(0) "" ["pinged"]=> string(0) ""
    ["post_modified"]=> string(19) "2011-03-18 14:36:08"
    ["post_modified_gmt"]=> string(19) "2011-03-18 18:36:08" ["post_content_filtered"]=> string(0) ""
    ["post_parent"]=> int(106)
    ["guid"]=> string(66) "http://hotchkissmade.com/wp-content/uploads/mugshot_khotchkiss.jpg"
    ["menu_order"]=> int(0)
    ["post_type"]=> string(10) "attachment"
    ["post_mime_type"]=> string(10) "image/jpeg"
    ["comment_count"]=> string(1) "0"
    ["filter"]=> string(3) "raw"
} }
或者你可以:

$arrayname = array_values($arrayname); // resort to 0 ... n-1

无论您喜欢哪个。

将为您提供数组中的第一个元素。您的工具似乎将数组条目存储在id(111)处。数组中随时还有其他元素吗?

是的,
array\u shift
是最好的选择,如果只有一个元素,您可以放弃数组。@Kyle Hotchkiss我很高兴答案对您有所帮助!
$arrayname = array_values($arrayname); // resort to 0 ... n-1