J'ai besoin de trouver des éléments communs entre deux tableaux. Mon code est:Array Intersect donnant une mauvaise sortie
$sql="SELECT DISTINCT fk_paytbl_discounts_discountid as discountid from paytbl_discounts_students WHERE fk_vtiger_cf_601='".$categoryid."'";
$discountstudentinfo=$objdb->customQuery($sql,false);
$sql1="SELECT DISTINCT fk_paytbl_discounts_discountid as discountid from paytbl_discounts_variants WHERE fk_vtiger_products_productid='".$variantid."'";
$discountvariantinfo=$objdb->customQuery($sql1,false);
$commondiscount=array_intersect($discountvariantinfo,$discountstudentinfo);
Premier tableau
Array
(
[0] => Array
(
[discountid] => 2
)
[1] => Array
(
[discountid] => 8
)
[2] => Array
(
[discountid] => 5
)
[3] => Array
(
[discountid] => 4
)
)
tableau Second
Array
(
[0] => Array
(
[discountid] => 1
)
[1] => Array
(
[discountid] => 5
)
)
Common Array
Array
(
[0] => Array
(
[discountid] => 1
)
[1] => Array
(
[discountid] => 5
)
)
Common Array ne devrait avoir qu'une discountid 5 mais son représentant 1 aussi .
S'il vous plaît aidez-moi sur ce
Merci