php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #53265 Example too complicated
Submitted: 2010-11-08 14:38 UTC Modified: 2010-11-08 19:06 UTC
From: marco at palzkill dot de Assigned: frozenfire (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: Irrelevant OS: Any
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: marco at palzkill dot de
New email:
PHP Version: OS:

 

 [2010-11-08 14:38 UTC] marco at palzkill dot de
Description:
------------
---
From manual page: http://www.php.net/function.array-filter#Examples
---

Hi,

the bitwise comparison with & in the callback function strikes me as too complicated for beginners to easily understand, and thus rendering the example sort of useless. 
I use PHP a lot and had to look up &.

I would suggest to replace the return argument in the callback function with something that is easier to understand.

Marco


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-11-08 19:01 UTC] frozenfire@php.net
Using the bitwise and operator to determine whether a number is even or odd is not all that complicated. In any case, it's evident to anyone reading the example that the functions "odd" and "even" return whether the input integer is odd or even.

The only potentially reasonable change is to add a comment to each function indicating what it does.
 [2010-11-08 19:06 UTC] frozenfire@php.net
Automatic comment from SVN on behalf of frozenfire
Revision: http://svn.php.net/viewvc/?view=revision&revision=305207
Log: Clarified example as per bug #53265.
 [2010-11-08 19:06 UTC] frozenfire@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: frozenfire
 [2010-11-08 19:06 UTC] frozenfire@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 09:01:27 2024 UTC