- var_dump: documentation ( source)
<?php
class X{
public $real = [];
public function __construct(){
$this->real ['qty']= 15;
}
public function &setData(){
return $this->real;
}
}
$x = new X();
$x->setData()['qty'] = 22;
$x->setData()['qty2'] = 'haha yeah, we should not use refs :)';
var_dump($x->real);