Aprire il file PHP in un editor di testo come Blocco note di Windows . 
 2 
 Dichiarare un array bidimensionale . Richiamare la funzione " array_multisort " per ordinare l'array e visualizzarne il valore selezionato per l'aggiunta del codice : 
 
 $ myArray = array ( array di 
 
 ( 7 , 11 , 2 , 10 , 200 ) , 
 matrice 
( 1 , 65 , 2 , 3 , 76 ) per
 ) ; 
 
 array_multisort ( $ myArray [ 0 ] , SORT_NUMERIC , SORT_ASC , $ myArray [ 1 ] ) ; 
 
 print_r ( $ myArray ) ; 
 
 È possibile utilizzare " SORT_NUMERIC " , " SORT_REGULAR " o " SORT_STRING " come argomento per impostare quale tipo i valori della matrice devono essere trattati come . L' tipi " SORT_REGULAR " " SORT_STRING " e sono case-sensitive . Il " SORT_ASC " e " SORT_DESC " impostare l' ordinamento deve essere fatto in ordine crescente o decrescente 
 
 Gli array ordinati hanno un valore di : . 
 
Array ( 2 , 7 , 10 , 11 , 200 ) per
 Array ( 2 , 1 , 3 , 65 , 76) 
 3 
 dichiarare un array associativo , lo scompone , richiamare la funzione " array_multisort " per ordinare e poi visualizzarne il valore selezionato per l'aggiunta del codice : 
 
 $ myArray = array ( array di 
 
( " FRUTTA " = > " banane ", "colore " = > " GIALLO " ) , Stati matrice
( " FRUTTA " = > " arancia ", "colore " = > "Orange" ) , Stati matrice
( " FRUTTA " = > " mela " , " COLORE " = > " RED " ) per
 ) ; 
 
 foreach ( $ myArray da $ n = tasto> $ ) { $ 
 
 sort_fruit [ key ] = $ [ 'Frutta' ] ; 
 
 $ sort_color [ ] = $ chiave [ 'colore' ] ; } 
 
 
 
 array_multisort ( $ sort_fruit , SORT_ASC , $ sort_color , SORT_STRING , $ myArray ) ; 
 
 print_r ( $ myArray ) ; 
 
 Gli array ordinati hanno un valore di : 
 
Array ( " FRUTTA " = > " mela " , " COLORE " = > " RED " ) per
Array ( " FRUTTA " = > " banane "," colore " = > " GIALLO " ) per
Array ( " FRUTTA " = > " arancia ", "colore " = > "Orange" ) economici 4
 Salvare il file PHP e caricarlo sul vostro server per ordinare gli array bidimensionali . 
 
 
              
Programmazione © www.354353.com