no save
Assistance
Achat
News

Forum | webmastering
Comment afficher une fonction array
mimi, le lun. 29 mai 2006 à 11:53:51
Bonjour,

J'ai ce code, et j'aimerais qu'il affiche le résultat :

$products=array(array('TIR', 'Tires', 100),
array('OIL', 'Oil', 10),
array('SPK', 'Spar plugs', 4)
);

function compare($x,$y)
{
if($x[1] == $y[1])
return 0;
else if($x[1]<$y[1])
return -1;
else
return 1;
}
usort($products,'compare');

Je n'arrive pas à afficher le résultat escompté, à savoir un affichage par ordre alphabétique pour la deuxième colonne.
J'ai essayé avec des for, while, foreach, mais à chaque fois ça écrit "ArrayArrayArray".

Help me pliz :o)


P@
mai 06
Suivant
REPONSES
P@
mai 06
mimi
mai 06
P@
mai 06
mimi
mai 06
P@
mai 06
mimi
mai 06
P@
mai 06
mimi
mai 06
P@
mai 06
Version Web
Réalisé par RedShift
no save