Bug #77545 [Opn->Nab]: wrong output of array_diff

From: Date: Wed, 30 Jan 2019 08:32:25 +0000
Subject: Bug #77545 [Opn->Nab]: wrong output of array_diff
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-219285@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77545&edit=1 ID: 77545 Updated by: requinix@php.net Reported by: bostjan dot kristl at gmail dot com Summary: wrong output of array_diff -Status: Open +Status: Not a bug Type: Bug Package: *General Issues Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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 http://php.net/manual/en/function.array-diff.php > ...returns the values in array1 that are not present in any of the other arrays. Perhaps you are looking for array_diff_assoc? http://php.net/manual/en/function.array-diff-assoc.php Previous Comments: ------------------------------------------------------------------------ [2019-01-30 08:20:42] bostjan dot kristl at gmail dot com Description: ------------ I have tested in version Debian 9, PHP 7.0.33-0+deb9u1 and CentOS Linux release 7.6.1810, 7.2.14 array_diff in first example show, that is no difference between arrays values Test script: --------------- $t1['c'] = 3; $t1['i'] = 10; $t1['iv'] = 10; $t2['c'] = 3; $t2['i'] = 10; $t2['iv'] = 11; var_dump(array_diff($t1,$t2)); var_dump(array_diff($t2,$t1)); Expected result: ---------------- array(1) { ["iv"]=> int(11) } array(1) { ["iv"]=> int(11) } Actual result: -------------- array(0) { } array(1) { ["iv"]=> int(11) } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77545&edit=1

« previous php.bugs (#219285) next »