Answers for "php objects array get values as array"

PHP
0

object values to array php

array_values(get_object_vars($object));
Posted by: Guest on September-18-2020
1

php get all in object as array

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 );
Posted by: Guest on October-02-2021

Code answers related to "php objects array get values as array"

Browse Popular Code Answers by Language