note 10176 modified in get_class_vars by zak

From: Date: Fri, 19 Jan 2001 06:46:38 +0000
Subject: note 10176 modified in get_class_vars by zak
Groups: php.notes 
Request: Send a blank email to php-notes+get-9957@lists.php.net to get a copy of this message
/**** BEGIN OF CODE ****/ class xyz { var $x = 999; var $y = 123; function abc() { $this->x = 0; } function abc1() { $this->x = 1; } function abc2() { $this->x = 2; } function abc3() { $this->x = 3; } function abcx() { print $this->x + $this->y; } } $my_class = new xyz(); // print all methods of $my_class $arr = get_class_methods(get_class($my_class)); for ($i=0;$i<count($arr);$i++) print "Function $i : $arr[$i]\n"; print "\n"; // print default properties of $my_class $arr = get_class_vars(get_class($my_class)); while(list($key,$val) = each($arr)) print "Properties $key has value : $val\n"; /***** END OF CODE *****/ The result : Function 0 : abc Function 1 : abc1 Function 2 : abc2 Function 3 : abc3 Function 4 : abcx Properties x has value : 999 Properties y has value : 123 rgds, LexZEUS http://www.php.net/manual/get-class-vars.php

« previous php.notes (#9957) next »