- var_dump: documentation ( source)
<?php
class foo {
public $value = [];
public function &getValue() {
return $this->value;
}
}
$obj = new foo;
$myValue = &$obj->getValue(); // $myValue is a reference to $obj->value, which is 42.
$myValue[] = 123;
var_dump($obj->value);