📜  php 将对象中的所有内容作为数组获取 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:10.242000             🧑  作者: Mango

代码示例2
class Foo
{
    private $foo;
    protected $bar;
    public $baz;

    public function __construct()
    {
        $this->foo = 1;
        $this->bar = 2;
        $this->baz = new StdClass;
    }
}

var_dump( (array) new Foo );