php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43800 php developer
Submitted: 2008-01-09 17:19 UTC Modified: 2008-01-12 15:27 UTC
From: subson at gmail dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 5.2.5 OS: Windows XP
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: subson at gmail dot com
New email:
PHP Version: OS:

 

 [2008-01-09 17:19 UTC] subson at gmail dot com
Description:
------------
This is the existing code i Found in php.net manual,

It has 3 parameters, what is the purpose of 3rd parameter.

If it is going to check from 3rd array also any intersecting elements.

I tried code below with 3 arrays but it displayed me empty array.

Working Code from PHP manual:
*******************************************************************
array array_diff ( array array1, array array2 [, array ...] )


array_diff() returns an array containing all the values of array1 that are not present in any of the other arguments. Note that keys are preserved. 

Example 1. array_diff() example

<?php
$array1 = array("a" => "green", "red", "blue", "red");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);

print_r($result);
?>  

Multiple occurrences in $array1 are all treated the same way. This will output : 

Array
(
    [1] => blue
)
**********************************************************************
**********************************************************************




Reproduce code:
---------------
Code i Tried:
**********************************************************************
<?php

$array1 = array("a" => "green", "red", "blue","white");
$array2 = array("b" => "green", "yellow", "red");
//$array3 = array("white");
$array3 = array();
$result = array_intersect($array1, $array2,$array3);

print_r($result);
?> 
// Output
Array
(
)
an empty Array
********************************************************************** 




Expected result:
----------------
it should check in the 3rd array also for any intersecting elements and then it should display the elements from array1 which are intersecting with either 2nd or 3rd array.

Actual result:
--------------
An empty Array

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-12 15:27 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 29 23:00:03 2025 UTC