Jump to content

Assembler 2 tableaux associatifs


sparh

Recommended Posts

Bonjour,

je galère depuis plusieurs jours sur ce problème, fusionner 2 tableaux associatifs, exemple:

Mes 2 tableaux:

tablo_membre

Array ( [0] => Array ( [id] => 1 [pseudo] => jimmy [point] => 13 [id_parrain] => 0 ) [1] => Array ( [id] => 2 [pseudo] => jhon [point] => 0 [id_parrain] => 0 ) )

tablo_score

Array ( [0] => Array ( [score_final] => 18 ) [1] => Array ( [score_final] => 0 ) ) 

et ce que j'aimerai avoir

Array ( [0] => Array ( [id] => 1 [pseudo] => jimmy [point] => 13 [id_parrain] => 0 [score_final] => 18 ) [1] => Array ( [id] => 2 [pseudo] => jhon [point] => 0 [id_parrain] => 0[score_final] => 0 ) )

J'ai testé array_merge, array_combine et plein d'autre fonctions sans trouver alors si vous pouviez m'aider ce serait génial!

Merci d'avance

Edited by sparh
Link to post
Share on other sites

Bonjour Sparh,

pour ma part, je le ferais à la mano :


foreach ($tablo_score as $NumScore=>$Score)
$tablo_global[$NumScore]=array_merge($tablo_score[$NumScore],$tablo_membre[$NumScore]);

Logiquement, ça devrait marcher... En même temps, on est lundi et je ne suis pas à fond...

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...