Jump to content

Problem with Arrays


Emmash

Recommended Posts

Hi,

 

I'm having a problem with array's functions

 

<?php
//Making the list of the differents arrays
if($cpt_couleur+1<count($_POST["couleur"])){
$liste_tableaux_couleur.=${"tab_resultat_couleur".$cpt_couleur}.",";
}
else{
$liste_tableaux_couleur.=${"tab_resultat_couleur".$cpt_couleur};
}

//Keeping only the numbers that are present in each table
if(count($_POST["couleur"])>1){
$tab_resultat_couleur=array_merge(array_intersect($liste_tableaux_couleur));
}
else{
$tab_resultat_couleur=$liste_tableaux_couleur;
}?>

 

The problem is that array_intersect needs 2 parameters to work... I've

also tried with dynamic variables but I think I code the wrong thing 'cause it

didn't solve my problem... Is there any way to just write the content of

the variable $liste_tableaux_couleur in the function array_intersect...

something that would execute the line like :

<?php
$tab_resultat_couleur=array_merge(array_intersect($tab_resultat_couleur0,$tab_resultat_couleur1,$tab_resultat_couleur2));
...
?>

 

Thanks a lot!!!!

 

Marie-Hélène

 

(edited by kenrbnsn to add


tags)

Link to comment
https://forums.phpfreaks.com/topic/127558-problem-with-arrays/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.