note 86327 added to function.get-class

From: Date: Mon, 13 Oct 2008 13:20:09 +0000
Subject: note 86327 added to function.get-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-145312@lists.php.net to get a copy of this message
I really needed to use get_called_class in a particular project, but my local dev environment is stuck on PHP 5.2.6 due to being reliant on Wamp. This isn't an issue for the live server so I added this temporary hack. I'm not proud of it but it does the job and will do me until I can upgrade Wamp or have more time to do a proper install on my work machine. Will take it out as soon as I can. <?php if(function_exists('get_called_class')){ $class = get_called_class(); }else{ $trace = debug_backtrace(); $class = $trace[1]['class']; } ?> Sorry. ;) ---- Server IP: 92.48.74.199 Probable Submitter: 82.110.129.42 ---- Manual Page -- http://www.php.net/manual/en/function.get-class.php Edit -- https://master.php.net/note/edit/86327 Del: integrated -- https://master.php.net/note/delete/86327/integrated Del: useless -- https://master.php.net/note/delete/86327/useless Del: bad code -- https://master.php.net/note/delete/86327/bad+code Del: spam -- https://master.php.net/note/delete/86327/spam Del: non-english -- https://master.php.net/note/delete/86327/non-english Del: in docs -- https://master.php.net/note/delete/86327/in+docs Del: other reasons-- https://master.php.net/note/delete/86327 Reject -- https://master.php.net/note/reject/86327 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#145312) next »