PHP 4.0 Bug #6002 Updated: array_diff / array_intersect returning wrong elements
| From: | Bug Database | Date: | Mon, 07 Aug 2000 11:57:47 +0000 |
| Subject: | PHP 4.0 Bug #6002 Updated: array_diff / array_intersect returning wrong elements | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28004@lists.php.net to get a copy of this message | ||
ID: 6002
Updated by: waldschrott
Reported By: hpdl@theexchangeproject.org
Status: Analyzed
Bug Type: Feature/Change Request
Assigned To:
Comments:
both: array_diff() && array_intersect:
not really sure whether it´s a documentation issue (unexpected behaviour) or a bug, if you try
"var_dump($result);" you´ll receive
array(2) { [1]=> string(5) "page2" [2]=> string(5) "page3" }
that´s fine, it has preserved the keys too! (perhaps a nice feature)
I think it´s like with comparing arrays with == and ===, I´d vote for a FLAG on array_diff() (and
array_intersect()), indicating if it should perform an ordered _diff (_intersect)(preserving keys,
usually equal or fewer matches then unordered _diff) or unordered _diff
(_intersect)(flatten(resuling array begins at index 0), finds all similarities)
Resumé: I think it should be transformed into a Feature/Request bug and if not changed, it should
be documented.
Full Bug description available at: http://bugs.php.net/?id=6002