- var_dump: documentation ( source)
<?php
class A
{
static $count;
function b()
{
if (null === static::$count) {
static::$count = 1;
return ['a', 'b'];
}
return static::$count++;
}
}
$a = new A;
var_dump($a->b(), $a->b());
A::$count = null;
$a = new A;
var_dump($a->b()[$a->b()]);