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