1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
|
//fonction qui genere mon tab a trier (issus du fichier txt precedent)
$Tab=file($GoFile);//print_r($Tab);
foreach ($Tab as $key => $Row) {
$Chps=explode("|",$Row); //echo $Chps[0]."--";
$Data[] =array($Chps[0],$Chps[1],$Chps[2],$Chps[3],$Chps[4]);
}
print_r($Data); //Voir resultat en dessous
usort($Data, "cmp1");
//resultat print_r($Data);
Array (
[0] => Array ( [0] => 157 [1] => 116 [2] => NomProd [3] => MonImg.jpg [4] => 400 )
[1] => Array ( [0] => 157 [1] => 401 [2] => NomProd [3] => MonImg.jpg [4] => 200 )
[2] => Array ( [0] => 157 [1] => 490 [2] =>NomProd [3] => MonImg.jpg [4] => 205 )
[3] => Array ( [0] => 157 [1] => 586 [2] => NomProd [3] => MonImg.jpg [4] => 457 )
[4] => Array ( [0] => 161 [1] => 23 [2] => NomProd [3] => MonImg.jpg [4] => 201 )
[5] => Array ( [0] => 162 [1] => 116 [2] => NomProd [3] => MonImg.jpg [4] => 400 )
[6] => Array ( [0] => 162 [1] => 483 [2] => NomProd [3] => MonImg.jpg [4] => 198 )
[7] => Array ( [0] => 162 [1] => 490 [2] => NomProd [3] => MonImg.jpg [4] => 205 )
[8] => Array ( [0] => 162 [1] => 670 [2] => NomProd [3] => MonImg.jpg [4] => 177 )
)
//A priori j'ai bien un tableau de la meme forme que ton lien
$tab = array(array(5,6,2),array(3,7,1),array(1,5,9),array(3,8,8),array(1,2,3),array(7,4,4),array(4,2,10)); |
Partager