#20295 [Com]: get_class_vars doesn't show values
| From: | kkobashi at thegrid dot net | Date: | Thu, 07 Nov 2002 09:37:38 +0000 |
| Subject: | #20295 [Com]: get_class_vars doesn't show values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-24268@lists.php.net to get a copy of this message | ||
ID: 20295
Comment by: kkobashi@thegrid.net
Reported By: kkobashi@thegrid.net
Status: Open
Bug Type: Class/Object related
Operating System: Win NT 4.0
PHP Version: 4.2.2
New Comment:
Sorry...
This is not a bug... only initialized class variables are shown.
Close this one
Previous Comments:
------------------------------------------------------------------------
[2002-11-07 02:51:54] kkobashi@thegrid.net
class A
{
var $hello;
var $world;
function A()
{
$this->hello = "hello";
}
}
$a = get_class_vars("A");
foreach ($a as $key => $val)
{
echo $key . ": " . $val . "<br>";
}
Output does not show the value as it suggests in the documentation. The
output I get is:
hello:
world:
Notice that the value of $hello is not shown.
Docs say uninitialized variables are not shown. But clearly hello is
initialized.
Calling this:
$a = get_class_vars("A");
print_r($a);
Produces:
Array ( [hello] => [world] => )
Which also is wrong because of no values in hello
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=20295&edit=1