- var_dump: documentation ( source)
- constant: documentation ( source)
<?php
class A {
private $b;
public function __construct(B $b) {
$this->b = $b;
var_dump($b->OMG);
}
}
class B {
const OMG = 10;
public function __get($name) {
return constant("self::" . $name);
}
}
$b = new B();
$a = new A($b);