test case##

class Test {
    public function actionGetObjectVarsVsArrayCast() {
        $obj = new TestA();

        println(get_object_vars($obj));
        println((array) $obj);

    }

}

class TestA {
    public $public = 1;
    protected $protected = 2;
    private $private = 3;
}

run result##

Array
(
    [public] => 1
)
Array
(
    [public] => 1
    [*protected] => 2
    [backend\controllers\TestAprivate] => 3
)

refer:

http://stackoverflow.com/questions/2512212/get-object-vars-vs-cast-to-array

http://www.php.net/manual/en/function.get-object-vars.php#47075

相关文章:

  • 2022-01-25
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
  • 2021-12-23
  • 2021-09-25
  • 2021-11-15
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
相关资源
相似解决方案