i am new at PHP and I need some help with sorting arrays based on a files. My code causes the array to have a separate sort - it sorts the contents of the first file first and then the second file.
$file1=@fopen("first.txt","r");
$file2=@fopen("second.txt","r");
while(!feof($file1) && !feof($file2))
{$tab[]=@fgets($file1);$tab[]=@fgets($file2);}
@fclose($file1);
@fclose($file2);
$opening=@fopen("prime.txt","w");
for($i=0;$i<sizeof($tab);$i++){sort($tab);@fwrite($opening,($tab[$i]."\n"));};
I don't know how to sort an array of two files.