note 113712 added to reflectionclass.getconstants

From: Date: Wed, 20 Nov 2013 10:00:55 +0000
Subject: note 113712 added to reflectionclass.getconstants
Groups: php.notes 
Request: Send a blank email to php-notes+get-197569@lists.php.net to get a copy of this message
I use a functions to do somthing base on the class constant name as below. This example maybe helpful for everybody. <?php public function renderData($question_type = NULL, $data = array()) { $types = array(); $qt = new ReflectionClass(questionType); $types = $qt->getConstants(); if ($type = array_search($question_type, $types)){ //.....Do somthing } } ?> ---- Server IP: 212.63.222.76 Probable Submitter: 2.180.49.124 ---- Manual Page -- http://php.net/manual/en/reflectionclass.getconstants.php Edit -- https://master.php.net/note/edit/113712 Del: integrated -- https://master.php.net/note/delete/113712/integrated Del: useless -- https://master.php.net/note/delete/113712/useless Del: bad code -- https://master.php.net/note/delete/113712/bad+code Del: spam -- https://master.php.net/note/delete/113712/spam Del: non-english -- https://master.php.net/note/delete/113712/non-english Del: in docs -- https://master.php.net/note/delete/113712/in+docs Del: other reasons-- https://master.php.net/note/delete/113712 Reject -- https://master.php.net/note/reject/113712 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#197569) next »