note 18483 deleted from function.get-class-vars by nlopess

From: Date: Fri, 24 Dec 2004 20:37:43 +0000
Subject: note 18483 deleted from function.get-class-vars by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-82278@lists.php.net to get a copy of this message
Note Submitter: r0k at DELkhype dot org ---- 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

« previous php.notes (#82278) next »