note 6126 deleted from get_object_vars by jmcastagnetto
| From: | jmcastagnetto@php.net | Date: | Mon, 04 Sep 2000 08:39:44 +0000 |
| Subject: | note 6126 deleted from get_object_vars by jmcastagnetto | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-4110@lists.php.net to get a copy of this message | ||
get_object_vars() takes an object and returns it's properties in an associative array. The
variable won't appear unless it's set, even if it's in the class definition. The
following example would print "b, c."
<pre>
class hello {
var $a;
var $b;
};
$obj = new hello;
$obj->b = 'world';
$obj->c = 'war';
$vars = get_object_vars($obj);
echo implode(', ', array_flip($vars));
</pre>