php - Combine two files -
i have 2 files want combine 2 files name in other file.
my first file (3 columns id;name;comment):
2538;api plazza - nov-16;acceuil chef de projet... nicolas pour briefing. 2538;api plazza - nov-16;exposer les produits de jive software 2538;api plazza - nov-16;objectifs de securité.... ope = secirité ? 2538;api plazza - nov-16;moa hr pas simple... 2538;api plazza - nov-16;grosse pression pour livrer vite et en charge moe obs + consultant obs pour deploiement jive...
my second file (2 columns id2;name):
tk-135;api plazza - nov-16
i want have in third file (4 columns id2;id;name;comment).
my code:
$tab1 = file('fichier1'); $tab2 = file('fichier2'); $taille = count($tab2); for($i=0;$i<$taille;$i++){ $vars = explode(';',$tab2[$i]); $taille2 = count($tab1); //echo $vars[1]; for($j=0;$j<$taille2;$j++){ $vars2=explode(';',$tab1[$j]); //echo $vars2[1]; if(isset($vars[1])){ if($vars2[1]==$vars[1]){ file_put_contents('f.txt',$vars2[0].';'.$tab2[$j],file_append); } } } }
but don't know why condition if($vars2[1]==$vars[1]) false...
thank you.
Comments
Post a Comment