Skip to content

Instantly share code, notes, and snippets.

@arnaud-lb
Created November 21, 2011 12:47
Show Gist options
  • Save arnaud-lb/1382539 to your computer and use it in GitHub Desktop.
Save arnaud-lb/1382539 to your computer and use it in GitHub Desktop.
<?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