Answers for "get the class of an object in php"

PHP
3

get class name from object php

// create an object
$bar = new foo();

// external call
echo "Its name is " , get_class($bar) , "\n";
Posted by: Guest on May-29-2020
0

Get class of an object variable php

<?php

namespace Foo\Bar;

class Baz {
    public function __construct()
    {

    }
}

$baz = new \Foo\Bar\Baz;
// get class of namespaced classes
var_dump(get_class($baz)); // result: string(11) "Foo\Bar\Baz"
?>
Posted by: Guest on November-10-2021

Code answers related to "get the class of an object in php"

Browse Popular Code Answers by Language