php - output string name of the class with the namespace -
namespace modules\quiz\model\quiz\valueobjects; class quizvo { }
is there programatic way retrieve string name of class along package name.
for instance (please note, class using quizvo in different namespace)
use modules\quiz\model\quiz\valueobjects\quizvo; $statement->setfetchmode(\pdo::fetch_class, quizvo::class); //need class package name here
instead of
$statement->setfetchmode(\pdo::fetch_class, 'modules\quiz\model\quiz\valueobjects\quizvo');
this possibly of php 5.5 in same way proposed it:
classname::class
before php 5.5 you'll need create object of wanted class , use get_class
Comments
Post a Comment