php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #66480 Ambiguous Language For array_diff() Documentation
Submitted: 2014-01-13 20:32 UTC Modified: 2015-03-25 21:11 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: mpearson at mpearson dot net Assigned: aharvey (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mpearson at mpearson dot net
New email:
PHP Version: OS:

 

 [2014-01-13 20:32 UTC] mpearson at mpearson dot net
Description:
------------
The documentation for array_diff() is a bit ambiguous in the "Description" section.

Quote: "Compares array1 against array2 and returns the difference."

While the statement is technically true, it is not until the "Return Values" section that the documentation clarifies that excess values in 'array2' will not be returned as well.

At a quick glance, if the description matches desired action the "Return Values" section may never be viewed to clarify the ambiguity from the description.

My recommendation would be to change the description to something like, " Compares array1 against array2 and returns the values from array1 which are not found in array2."

This makes it immediately clear that the values returned will not include non-matching values found in array2. Granted, the confusion could be blamed on the developer for not reviewing the entire documentation, but I am certain I am not the only person that will use a function based on the description matching the desired affect not expecting the description to be ambiguous.

Thanks!


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-01-15 08:58 UTC] aharvey@php.net
Automatic comment from SVN on behalf of aharvey
Revision: http://svn.php.net/viewvc/?view=revision&revision=332625
Log: Clarify the introductory array_diff() paragraph.

Fixes doc bug #66480 (Ambiguous Language For array_diff() Documentation).
 [2014-03-06 17:51 UTC] narf at devilix dot net
This has already been fixed.
 [2015-03-25 21:11 UTC] aharvey@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: aharvey
 [2015-03-25 21:11 UTC] aharvey@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.


 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Tue Oct 06 14:00:02 2026 UTC