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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tech at mediaforest dot net
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 01 17:01:34 2025 UTC