- var_dump: documentation ( source)
<?php
class Person
{
function getN(){return 5;}
function ret(){return $this;}
function retN(){return null;}
}
class NullPerson extends Person
{
function getN(){return 0;}
function ret(){return $this;}
function retN(){return null;}
}
$a = new Person();
$b = null;
var_dump(($a??new NullPerson())->getN(),
($b??new NullPerson())->getN());