php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #25129 Array_diff gives a bad result
Submitted: 2003-08-18 09:42 UTC Modified: 2003-08-18 09:48 UTC
From: tech at mediaforest dot net Assigned:
Status: Not a bug Package: Arrays related
PHP Version: Irrelevant OS: Linux
Private report: No CVE-ID: None
 [2003-08-18 09:42 UTC] tech at mediaforest dot net
Description:
------------
As this script shows, the array_diff function doesn't give the expected result on a php4.2.3 :



Reproduce code:
---------------
<?
$today_list = array("pic_0710.jpg","pic_0740.jpg");
$yesterday_list = array("pic_0710.jpg","pic_0740.jpg","pic_0910.jpg");
$result = array_diff($today_list,$yesterday_list);

var_dump($result);

?>

Expected result:
----------------
array(1) { [0]=>  string(12) "pic_0910.jpg" }

Actual result:
--------------
array(0) { }

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-08-18 09:48 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

From the manual:
array_diff() returns an array containing all the values of array1  that are not present in any of the other arguments.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Fri Jul 10 09:01:30 2020 UTC