php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #79883 Documentation on foreach neglects to mention the alternate syntax.
Submitted: 2020-07-22 07:19 UTC Modified: 2020-08-18 13:37 UTC
From: mark at manngo dot net Assigned:
Status: Open Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
50 - 12 = ?
Subscribe to this entry?

 
 [2020-07-22 07:19 UTC] mark at manngo dot net
Description:
------------
---
From manual page: https://php.net/control-structures.foreach
---

Apart from a helpful comment, there is no mention of the alternate syntax for foreach.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-07-22 07:28 UTC] cmb@php.net
-Status: Open +Status: Not a bug -Assigned To: +Assigned To: cmb
 [2020-07-22 07:28 UTC] cmb@php.net
There is a dedicated page for the alternative syntax of control
structures[1], and in my opinion, this is better than to mention
that again on all the other pages. 

[1] <https://www.php.net/manual/en/control-structures.alternative-syntax.php>
 [2020-07-22 08:17 UTC] mark at manngo dot net
Possibly, but since the pages on while, for, if and switch all mention the alternative syntax, this looks like an omission.
 [2020-07-22 08:30 UTC] cmb@php.net
-Status: Not a bug +Status: Open
 [2020-07-22 08:30 UTC] cmb@php.net
Indeed, the alternative syntax is mentionend on the while, for,
and switch pages (apparently not on the if page), so might make
sense to add this info on the foreach page as well.  I don't have
a strong feeling about either way.
 [2020-07-22 08:30 UTC] cmb@php.net
-Status: Assigned +Status: Open -Assigned To: cmb +Assigned To:
 [2020-07-22 08:41 UTC] mark at manngo dot net
I’d be more than happy to write something and submit that. Ditto for the if page.
 [2020-08-18 13:37 UTC] cmb@php.net
> I’d be more than happy to write something and submit that. Ditto
> for the if page.

You can submit PRs to <https://github.com/php/doc-en>.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Nov 27 20:03:20 2021 UTC