note 123306 rejected from language.oop5.traits by cmb

From: Date: Mon, 05 Nov 2018 14:20:32 +0000
Subject: note 123306 rejected from language.oop5.traits by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-209628@lists.php.net to get a copy of this message
Note Submitter: zhaowo8 at gmail dot com ---- Don't access a class which uses a trait before the definition of class. e.g. $myObj = new MyClass(); $myObj->says(); trait MyTrait { public function says(){ echo 'Hello World', '<br>'; } } class MyClass{ use MyTrait; } //Fatal error: Class 'MyClass' not found . Why?

« previous php.notes (#209628) next »