- defined: documentation ( source)
<?PHP
MyClass::myFunction(MyClass::MYCONST); // THIS GIVES THE ERROR
// This is the class..
class MyClass {
const MYCONST = 'BLA';
public static function myFunction($key) {
if (!defined(this::$key)) {
throw new Exception("$key is not defined as a constant");
}
}
}