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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 11:01:30 2024 UTC