Bonjour,
j'ai un tableau de cette forme stocké dans $_SESSION :
je cherche à trier les tableaux correspondant à chaque article en fonction du nom, prix, quantité. (en gros trier "l'étage" 1 du tableau en fonction des valeurs de "l'étage" 2)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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
29
30
31
32
33 array (size=1) 'panier' => array (size=6) 'TOURP-10' => array (size=4) 'id' => string 'TOURP-10' (length=8) 'nom' => string 'tournevis plat 10mm' (length=19) 'quantite' => int 1 'prix_u' => float 16.99 'TOURP-8' => array (size=4) 'id' => string 'TOURP-8' (length=7) 'nom' => string 'tournevis plat 8mm' (length=18) 'quantite' => int 2 'prix_u' => float 14.99 'VIS-3-25' => array (size=4) 'id' => string 'VIS-3-25' (length=8) 'nom' => string 'vis agglo 3×25mm' (length=17) 'quantite' => int 480 'prix_u' => float 0.07 'VIS-4-35' => array (size=4) 'id' => string 'VIS-4-35' (length=8) 'nom' => string 'vis agglo 4×35mm' (length=17) 'quantite' => int 185 'prix_u' => float 0.12 'VIS-4-45' => array (size=4) 'id' => string 'VIS-4-45' (length=8) 'nom' => string 'vis agglo 4×45mm' (length=17) 'quantite' => int 185 'prix_u' => float 0.15
exixte-il une fonction en php permettant de faire ce tri ou est-ce que je dois la faire moi même ?
j'ai vu qu'il existe une fonction array_multisort() mais je n'ai pas trop compris son fonctionnement et je ne sais pas si ça fait ce que je souhaite faire.
Partager