PHP Print keys from an object?

前端 未结 5 927
眼角桃花
眼角桃花 2021-01-07 18:07

I have an object BIRD and then there is [0] through [10] and each number has a subheading like \"bug\" or \"beetle\" or \"gnat\" and a value for each of those.

I wan

5条回答
  •  温柔的废话
    2021-01-07 18:20

    Similar to brenjt's response, this uses PHP's get_object_vars instead of type casting the object.

    $array = get_object_vars($object);
    $properties = array_keys($array);
    

提交回复
热议问题