Hi! > Generally when I've seen an object that did not implement Traversable > used with foreach it has been an error. The exception of course is > stdClass, particularly because of json_decode(). There was no > discussion on the list of allowing stdClass, but I did discuss it > with some people in chat. Our consensus was that a casting to an > array was a reasonable and simple requirement to allow an instance of > stdClass to be iterable. I do not think stdClass was designed for
I'm not sure I understand this part. Do you mean that this code: $a = json_decode('{"a": 1, "b": 2, "c": 3}'); foreach($a as $b) { var_dump($b); } will no longer work, or that it will still work, but stdClass would not be instanceof Iterable? -- Stas Malyshev smalys...@gmail.com -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php