- var_dump: documentation ( source)
<?php
class ππ
{
private π $π;
public function __construct()
{
$this->π = new π();
}
public function withπͺ(): self
{
$this->π->πͺ = true;
return $this;
}
public function build(): π
{
return clone $this->π;
}
}
class π
{
public bool $πͺ = false;
public function getInfo(): string
{
return $this->πͺ
? 'this car with chair'
: 'this car without chair'
;
}
}
$ππ = new ππ();
$π = $ππ->build();
var_dump($π->getInfo());
$π = $ππ->withπͺ()->build();
var_dump($π->getInfo());