- var_dump: documentation ( source)
<?php
interface Doll
{
function __invoke();
}
class LargeDoll implements Doll
{
private $inner;
function __construct(Doll $inner)
{
$this->inner = $inner;
}
function __invoke()
{
return ($this->inner)() . ' world';
}
}
class SmallDoll implements Doll
{
function __invoke()
{
return 'hello';
}
}
$russian = new LargeDoll(new SmallDoll());
var_dump($russian());