dump a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello, I would like to know why when I print_r or var_dump an object I
get the private properties. I give you an example:

<?php

class test
{
	private $myPrivate = 'topsecret';
}

$myTest = new test();

#echo $myTest->myPrivate; // Fatal error: Cannot access private property
test::$myPrivate in ..... that's OK!

echo '<pre>';
print_r($myTest);
#test Object
#(
#    [myPrivate:private] => topsecret
#)
var_dump($myTest);
#object(test)#1 (1) {
#  ["myPrivate:private"]=>
#  string(9) "topsecret"
#}
echo '</pre>';

?>

A private member is suposed to be private, isn't it?

Alex

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux