note 106741 added to function.get-class

From: Date: Fri, 02 Dec 2011 22:04:41 +0000
Subject: note 106741 added to function.get-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-184867@lists.php.net to get a copy of this message
Get class name without namespace This is the moust fast end more economy method function get_class_name($object) { if (!is_object($object) && !is_string($object)) { return false; } return trim(strrchr((is_string($object) ? $object : get_class($object)), '\\'), '\\'); } Pay attention to, in this method not include explode - this is take many memory function create at this conception (see below) me at nwhiting dot com 06-Dec-2010 04:14 I fix one bug $object=null change to just $object Good luck, and not use explode function everyway ---- Server IP: 69.147.83.197 Probable Submitter: 188.134.79.140 ---- Manual Page -- http://www.php.net/manual/en/function.get-class.php Edit -- https://master.php.net/note/edit/106741 Del: integrated -- https://master.php.net/note/delete/106741/integrated Del: useless -- https://master.php.net/note/delete/106741/useless Del: bad code -- https://master.php.net/note/delete/106741/bad+code Del: spam -- https://master.php.net/note/delete/106741/spam Del: non-english -- https://master.php.net/note/delete/106741/non-english Del: in docs -- https://master.php.net/note/delete/106741/in+docs Del: other reasons-- https://master.php.net/note/delete/106741 Reject -- https://master.php.net/note/reject/106741 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#184867) next »