Hi,
I'm having a problem with array's functions
//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 :
$tab_resultat_couleur=array_merge(array_intersect($tab_resultat_couleur0,$tab_resultat_couleur1,$tab_resultat_couleur2));
...
Thanks a lot!!!!
Marie-Hélène
PROBLEM WITH ARRAYS!!!!
Moderator: General Moderators
Re: PROBLEM WITH ARRAYS!!!!
I just want to find a way to write the content of the variable in my function to have something like
... all the names of tables are in my variable but I can't do , because I get the error that the function needs 2 parameters, is there a way to write the values of my variable directly into the parenthesis of the function????
is not an array but a string variable that contains, by example, differents names of tables like
The variable is in a loop because it can contains 2 table or 3 or 4...etc... depending on what the users chose.
Thanks a lot,
Marie-Hélène
Code: Select all
$liste_tableaux_couleurCode: Select all
array_intersect()Code: Select all
array_intersect($table1,$table2,$table3...)... all the names of tables are in my variable
Code: Select all
$liste_tableaux_couleurCode: Select all
array_intersect($liste_tableaux_couleur)Code: Select all
$liste_tableaux_couleurCode: Select all
"$table1,$table2,$table3"The variable
Code: Select all
$liste_tableaux_couleurThanks a lot,
Marie-Hélène
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: PROBLEM WITH ARRAYS!!!!
Hi everyone,
a man on another forum helps me get my answer.. so here it is :
Have a nice day!
Marie-Hélène
a man on another forum helps me get my answer.. so here it is :
Code: Select all
eval( '$tab_resultat_couleur = array_merge(array_intersect(' . $liste_tableaux_couleur . '));' );Marie-Hélène