|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69986 Foreach Documentation incorrectly implies generators cannot be used
Submitted: 2015-07-03 09:14 UTC Modified: 2015-07-06 12:35 UTC
From: nsalter at eandl dot co dot uk Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: nsalter at eandl dot co dot uk
New email:
PHP Version: OS:


 [2015-07-03 09:14 UTC] nsalter at eandl dot co dot uk
The sentence which says "foreach works only on arrays and objects" should probably be changed to read "foreach works only on arrays, objects and generators"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-06 12:35 UTC]
-Status: Open +Status: Not a bug
 [2015-07-06 12:35 UTC]
Generators, just like any other sort of Traversable, are all objects.
It just means that you can't use foreach on scalars.
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Wed Oct 28 04:01:23 2020 UTC