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

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -