- version_compare: documentation ( source)
<?php
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
echo 'Skip, no closures support';
return;
}
class Base {
public static function hi() {
$cl = function(){
echo Left::$prot;
};
$cl();
}
}
class Left extends Base {
protected static $prot = "Hello, world!\n";
}
class Right extends Base {
}
Base::hi();
Right::hi();