- spl_autoload_register: documentation ( source)
- var_dump: documentation ( source)
- file_put_contents: documentation ( source)
<?php
$a = <<<EOF
<?php
class a {
const a = b::c;
const b = b::d;
}
EOF;
file_put_contents('/tmp/A.php', $a);
$b = <<<EOF
<?php
class b {
const c = a::b;
const d = 1;
}
EOF;
file_put_contents('/tmp/B.php', $b);
spl_autoload_register(function($class) {
require('/tmp/'. $class .'.php');
});
var_dump(A::a, A::b, B::c, B::d);