<?php
class Test implements Iterator
{
public current()
{
return "value";
}
public key()
{
return new stdClass;
}
public next()
{
}
public rewind()
{
}
public valid()
{
return true;
}
}
$test = new Test;
foreach ($test as $key => $value) {
var_dump($key, $value);
break;
}
Parse error: syntax error, unexpected 'current' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/r2ps5 on line 5
Process exited with code 255.