Afficher un message
Vieux 12/09/2007, 08h30   #1
Yarco
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut How to get value of an private member?

For example:

<?php
class Test
{
private $name = 'yarco';
}

$p = new ReflectionPropery('Test', 'name');
print $p->getValue();

?>

This won't work. See: http://www.php.net/manual/en/languag...reflection.php
==================
Note: Trying to get or set private or protected class property's
values will result in an exception being thrown.
==================
But when we use print_r or var_dump, we could see the private member.
Why reflection doesn't support this?
(We have friend class in c++.)

  Réponse avec citation
 
Page generated in 0,04442 seconds with 9 queries