php.net |  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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
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
Description:
------------
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"


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-07-06 12:35 UTC] bwoebi@php.net
-Status: Open +Status: Not a bug
 [2015-07-06 12:35 UTC] bwoebi@php.net
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