get data from multi-dimensional array using PHP code

前端 未结 3 1438
无人及你
无人及你 2021-01-28 11:13

I\'m trying to get this data [label] => For Rent from a multi-dimensional array. Here is my array

Array ( [listing_id] => 0 
        [fields]          


        
相关标签:
3条回答
  • 2021-01-28 11:33
    echo $yourArray['fees'][30]->label
    

    It's not just an array... it's an array with an object in it. Use the -> to access object properties.

    0 讨论(0)
  • 2021-01-28 11:47

    Try

    $array[fees][30]->label
    

    Where $array is whatever you're top level variable is.

    0 讨论(0)
  • 2021-01-28 11:50

    You can access any value of array by their keys. simply access For Rent like this :-

    echo $arrayName['fees'][30]->label
    

    This will display For Rent like ( An Arrow operator because to access an object attribute you have to use this )

    0 讨论(0)
提交回复
热议问题