php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78685 wong..
Submitted: 2019-10-18 10:02 UTC Modified: 2019-10-18 10:12 UTC
From: shan dot liu at msn dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 7.3.10 OS: all
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: shan dot liu at msn dot com
New email:
PHP Version: OS:

 

 [2019-10-18 10:02 UTC] shan dot liu at msn dot com
Description:
------------
$a=array (
    'Fsku_id' => '30857',
);
$b=array (
    'Fsku_id' => '',
    'Fproduct_id' => '30857',
);
print_r(array_diff($a, $b));
output:
Array
(
)


Test script:
---------------
$a=array (
    'Fsku_id' => '30857',
);
$b=array (
    'Fsku_id' => '',
    'Fproduct_id' => '30857',
);
print_r(array_diff($a, $b));
output:
Array
(
)



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-10-18 10:12 UTC] pmmaga@php.net
-Status: Open +Status: Not a bug
 [2019-10-18 10:12 UTC] pmmaga@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

As stated in the documentation, array_diff compares the values present in the arrays. If you want the check to include the keys, you should use array_diff_assoc.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 20:01:31 2024 UTC