note 17147 deleted from control-structures.foreach by jimw
| From: | jimw@php.net | Date: | Mon, 17 Dec 2001 23:11:38 +0000 |
| Subject: | note 17147 deleted from control-structures.foreach by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23059@lists.php.net to get a copy of this message | ||
foreach iterates on object attributes.
For instance, this:
class C { var $a = 1; var $b = 2; }
foreach (new C as $k => $v) echo nl2br("$k = $v\n");
outputs this:
a = 1
b = 2
This definitely works on PHP 4.0.3 and 4.0.4.