小编Ale*_*meo的帖子

检查它是否是来自 SimpleXMLElement 对象的数组

我对以下 php 对象转储有问题。我尝试检查“价格”是否是一个数组,php 总是返回 false。数组“price”的var_dump()返回数组的第一个元素,而不是整个数组。哪个是错误的?如何检查它是否是一个数组?

object(SimpleXMLElement)#197 (1) {
    ["price"]=>  array(4) {
        [0]=>    object(SimpleXMLElement)#156 (4) {
            ["room_id"]=>      string(4) "1755"
            ["room_seq"]=>      string(1) "1"
            ["offer_id"]=>      string(4) "5842"
            ["price_total"]=>      object(SimpleXMLElement)#205 (2) {
                ["price_typ"]=>        string(1) "0"
                ["price_hb"]=>        string(4) "2450"
            }
        }
        [1]=>    object(SimpleXMLElement)#143 (4) {
            ["room_id"]=>      string(5) "24206"
            ["room_seq"]=>      string(1) "1"
            ["offer_id"]=>      string(4) "5842"
            ["price_total"]=>      object(SimpleXMLElement)#205 (2) {
                ["price_typ"]=>        string(1) "0"
                ["price_hb"]=>        string(4) "2450"
            }
        }
        [2]=>    object(SimpleXMLElement)#135 (4) {
            ["room_id"]=>      string(4) "1755"
            ["room_seq"]=>      string(1) "1"
            ["offer_id"]=>      string(6) "415725"
            ["price_total"]=>      object(SimpleXMLElement)#205 (2) { …
Run Code Online (Sandbox Code Playgroud)

php arrays object

1
推荐指数
1
解决办法
3095
查看次数

标签 统计

arrays ×1

object ×1

php ×1