How to dynamically create an anonymous class that extends an abstract class in PHP? -


simply, let me explain example.

<?php class extends thread {     public function run() {         /** ... **/     } } $my = new my(); var_dump($my->start()); ?> 

this php manual.

i wondering if there way in more java-like fashion. example:

<?php $my = new thread(){         public function run() {             /** ... **/         }       }; var_dump($my->start()); ?> 

alternatively, can use php7's anonymous classes capability documented @ http://php.net/manual/en/migration70.new-features.php#migration70.new-features.anonymous-classes , http://php.net/manual/en/language.oop5.anonymous.php


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -