Skip to main content

Sort the array of characters in the array: PHP

If you want to select an array in the array to retrieve data from a particular variable and sorted you can use the following as an example:

<?php

$f = array(
            array('Name' =>'Ucup', 
                  'Class' => 7),
            array('Name' => 'Faizal',
                  'Class' => 9),
            array('Name' => 'Abdul',
                  'Class' => 8)
            );

function sort($r,$d)
{
    return strnatcmp($r['Name'],$d['Name']);
}

usort($f,'sort');
foreach($f as $k=>$v)

    echo $v['Name'];
}

?>

On the listing coding above are arrays in the array contains variables and class name with a certain value, the first array contains the name of the class ucup and 7, both faizal and 9th grade, third grade 8. The name Abdul 

function sequence {return strnatcmp}; // useful to sort the array of characters in the array ($ r $ d); 
foreach ($ f as $ k => $ v); // $ f is the name of an array of data and then split $ k and $ v variable. 
echo $ v [ 'name']; // display the variable ($ v) the contents of the value of 'name'; 

The result:
The contents of the variable names will be ordered


If you have any questions please comment. 
Do not forget to like and share. 
Learn Programming in fajaryusuf.com wrote. :)

Comments

Popular posts from this blog

Menambahkan Peraturan Komentar Pada Blog

Menambahkan Peraturan Komentar Pada Blog : Ngblog Menulis sebuah artikel dan dikomentari dengan link aktif/promosi produk dan kata kata spam lainnya memang tidak mengenakan anda mungkin akan sangat merasa kecewa sekali, anda mungkin seperti menulis sebuah artikel namun tidak dihargai karyanya oleh orang lain. Mungkin membuat aturan berkomentar di blog adalah salah 1 cara menetralisirnya, mungkin jika ada aturan tersebut orang berpikir 2 kali untuk meninggalkan komentar Spam, lalu bagaimana cara membuat aturan komentar tersebut? langsung saja kita praktekan Ikuti langkah berikut : Login ke bloger,masuk ke blog yang anda inginkan, Klik Setelan -> POS-KOMENTAR   Scroll kebawah dan cari menu "pesan formulir komentar" klik tambahkan , dan isi kolom sesuai keinginan kalian atau peraturan yang kalian inginkan.  Setelah selesai silakan klik simpan setelan dipojok kanan atas. Lihat hasilnya di blog kalian ,akan seperti ini : Jika ada pertanyaan...

Contoh Program C++ : Konversi Bilangan Hexadesimal, Oktal , Biner.

Hai Pembaca FajarYusuf.Com yang pintar dan berwawasan tinggi, kali ini FajarYusuf.Com akan post Contoh Program C++ : Konversi Bilangan Hexadesimal, Oktal , Biner . Mari kita membuat program konversi bilangan yang sangat mudah di buat dengan menggunakan bahasa pemrograman C++. Yaitu dengan menggunakan type data long, untuk Hexadesimal dengan rumus : <<hex<<desimal (merubah dari bilangan Desimal ke Hexadesimal) , untuk Oktal dengan rumus : <<oct<<desimal (merubah dari bilangan Desimal ke Oktal). Dan untuk biner dilakukan pembagian 2. Contoh Coding Program C++ Konversi Bilangan: #include<iostream> using namespace std; int main() { long desimal, pembagi=1073741824, bit; cout<<"Nilai Desimal : "; cin>>desimal; cout<<"Hexadesimal = "<<hex<<desimal<<endl; cout<<"Oktal = "<<oct<<desimal<<endl; ...

Traha Infinity a lancé une campagne événementielle de pré-inscription

Moai Games a officiellement annoncé la sortie d’ un  nouveau  MMORPG  intitulé  Traha Infinity , dans la première moitié de 2022. Ce jeu mobile devrait se dérouler 200 ans avant les événements des précédents jeux  Traha , il a  des  graphismes  Full 3D  et optimisés performances haut de gamme pour smartphones. Traha a  été un énorme succès en Corée avec 4,2 millions de précommandes avant sa sortie officielle en 2019, le jeu mobile n’a jamais eu de sortie mondiale. Ce jeu a été développé par Moai Games et publié par  Nexon , et est devenu l’un des jeux les plus vendus de l’époque. Et maintenant,  Traha Infinity  continuera le même monde comme une suite, plutôt une préquelle. Le nouveau jeu présentera la même vision du monde et la même topographie que le jeu précédent, mais présentera un nouveau scénario. Ils se vantent d’ une qualité graphique  Full 3D haut  de gamme ainsi que d’un système optimisé pour les smartphones. Les joueurs pourront explorer l...