note 18483 added to function.get-class-vars

From: Date: Thu, 24 Jan 2002 21:21:18 +0000
Subject: note 18483 added to function.get-class-vars
Groups: php.notes 
Request: Send a blank email to php-notes+get-25786@lists.php.net to get a copy of this message
as they told: <?php class cHost { var $_url=0; function cHost( $url ) { $this->_url = $url; } } class cHostPort extends cHost { var $_port; function cHostPort( $url, $port ) { $this->cHost( $url ); $this->_port = $port; } } $host = new cHostPort("www", 8002); // class vars $vars = get_class_vars(get_class($host)); echo "<b>class vars</b>"; foreach( $vars as $name => $value ) { echo "<li>".$name." : ".$value; } // object vars $vars = get_object_vars($host); echo "<b>object vars</b>"; foreach ($vars as $name => $value) { echo "<li>".$name." : ".$value; } ?> gives expected results: class vars: _url : 0 object vars: _url : www _port: 8002 -- http://www.php.net/manual/en/function.get-class-vars.php http://master.php.net/manage/user-notes.php?action=edit+18483 http://master.php.net/manage/user-notes.php?action=delete+18483 http://master.php.net/manage/user-notes.php?action=reject+18483

« previous php.notes (#25786) next »