- var_dump: documentation ( source)
<?php
trait Error {
private $_errors;
private function _init(){
$this->_errors = (object) [
'small' => 'Small mistake'
];
}
public function getError(){
var_dump($this->_errors);
}
}
class Test {
use Error;
public function __construct(){
$this->_errors = $this->_init();
}
}
$obj = new Test();
$obj->getError();