note 113763 deleted from language.oop5.traits by cmb

From: Date: Tue, 08 Sep 2015 19:47:24 +0000
Subject: note 113763 deleted from language.oop5.traits by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203741@lists.php.net to get a copy of this message
Note Submitter: peter at icb dot at ---- You cannot use a trait whos name is in a variable like: <?php trait mytrait { public $x; } $tr = 'mytrait'; class myclass { use $tr; ... } ?> If you really need that, you have to use eval: <?php eval(" class my_tmp_class { use $tr; } "); class myclass extends my_tmp_class { ... } ?>

« previous php.notes (#203741) next »