|  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
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);



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

Actual result:
array(0) { }


Add a Patch

Pull Requests

Add a Pull Request


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

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-2021 The PHP Group
All rights reserved.
Last updated: Sat Mar 06 14:01:22 2021 UTC