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
Post a Comment