Check variable is public php

后端 未结 3 1336
借酒劲吻你
借酒劲吻你 2021-01-29 10:49

I want to check if a local variable in a class is public or private. The reason is to create a function like this:

function ToArray() {
  $arr = array();
  forea         


        
3条回答
  •  囚心锁ツ
    2021-01-29 10:54

    To get a list of all public attributes call get_object_vars().

    (Hint: calling it by the object itself will return all attributes.)

提交回复
热议问题