|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-10-08 00:42 UTC] ngualano at yahoo dot it
Description:
------------
why, the property 'name' in the ReflectionObject, returns the name of the class
instead of name of instance of class?
we have, already the method 'getName' for obtain the class name;
Please implements this change, i need to obtain the name of instance inside of
constructor and other methods.
Test script:
---------------
<?php
class storage {
function __construct(){
$p= new ReflectionObject($this);
echo $p->name;
}
}
$mystore = new storage('pub');
//when the object is constructed echo() display 'storage' instead 'mystore'
?>
Expected result:
----------------
mystore
Actual result:
--------------
storage
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 23 09:00:02 2025 UTC |
Not possible/wouldn't make sense. As to the second part, there is no sensible solution for this case: $mystore = new storage('pub'); $mystore2 = $mystore; or $this->prop = new storage('pub');