<?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");
}
}
}
Fatal error: Uncaught Error: Class "this" not found in /in/VNZTr:10
Stack trace:
#0 /in/VNZTr(2): MyClass::myFunction('BLA')
#1 {main}
thrown in /in/VNZTr on line 10
Process exited with code 255.
Fatal error: Uncaught Error: Class 'this' not found in /in/VNZTr:10
Stack trace:
#0 /in/VNZTr(2): MyClass::myFunction('BLA')
#1 {main}
thrown in /in/VNZTr on line 10
Process exited with code 255.