- print_r: documentation ( source)
- get_object_vars: documentation ( source)
<?php
class Foo
{
private $name;
private $age;
private $gender;
public static $time;
function __construct($name, $age, $gender, DateTime $time)
{
$this->name = $name;
$this->age = $age;
$this->gender = $gender;
self::$time = $time->getTimestamp();
}
}
$foo = new Foo('hchen', 10, 'M', new DateTime('now'));
$newFoo = Closure::bind(
function() {
return get_object_vars($this);
}, $foo, 'Foo');
print_r(PHP_EOL.'<pre>========== START DEBUG: $newFoo =========='.PHP_EOL);
print_r($newFoo());
print_r(PHP_EOL.'========== END OF $newFoo DEBUG ==========</pre>'.PHP_EOL);
die();
?>