- print_r: documentation ( source)
<?php
class X
{
public $hi;
public function hi($hi)
{
$this->hi = $hi;
}
}
class A
{
protected function foo($name, Closure $t)
{
$x = new X();
echo $name;
echo "\n";
$t($x);
print_r($x);
}
}
class B extends A
{
public function __construct()
{
$this->foo('users', function($t) {
$t->hi('hello!');
});
}
}
new B();