note 52579 added to function.get-class

From: Date: Fri, 06 May 2005 09:21:32 +0000
Subject: note 52579 added to function.get-class
Groups: php.notes 
Request: Send a blank email to php-notes+get-88994@lists.php.net to get a copy of this message
/** * get name of object by its value, if its name does unique * * @param object $object * @return string */ function get_instance_name($object) { $instance = md5(serialize($object)); foreach( $GLOBALS as $variable => $value ) if( md5(serialize($value)) == $instance ) return $variable; } //--(End)-->example class Foo { public function get_name() { return get_instance_name($this); } } $foo = new Foo; echo $foo->get_name(); //--(End)-->example ---- Manual Page -- http://www.php.net/manual/en/function.get-class.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52579 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52579&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52579&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52579&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52579&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52579&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52579&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#88994) next »