Created
November 21, 2011 12:47
-
-
Save arnaud-lb/1382539 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class foo implements IteratorAggregate | |
{ | |
public $a; | |
public $b; | |
public function getIterator() | |
{ | |
return new ArrayIterator(array('foo', 'bar')); | |
} | |
} | |
$foo = new foo; | |
$props = array(); | |
foreach($foo as $name => $value) { | |
$props[$name] = true; | |
} | |
// $props is not foo's properties | |
var_dump($props); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment