terima kasih semua atas petunjuknya, misalnya datanya bener2 acak, maksudnya tahunnya tidak semuanya dibelakang, ada yg didepan, tengah, gimana yah ? maaf klo banyak tanya.
salam tito Danny Eka <[EMAIL PROTECTED]> wrote: coba pake code below : ====================START================== <?PHP /** * - buku 2007 * - majalah terbit II/XI/1989 * - komik 1978 * - flyer II/XX/1999 * Kecil - Besar */ $data = array("buku 2007","majalah terbit II/XI/1989","komik 1978","flyer II/XX/1999"); for($i = 1; $i <= count($data) - 1; $i++) { for($j = $i; $j < count($data); $j++) if(substr($data[$i-1], -4, 4) < substr($data[$j], -4, 4) ) { $buffer = $data[$i-1]; $data[$i-1] = $data[$j]; $data[$j] = $buffer; } } print_r($data); ?> ====================END================== Pada tanggal 27/04/07, tito surya wardhana <[EMAIL PROTECTED]> menulis: > > Dear all, > > saya ada tabel tb_contoh, salah satu field namanya urut yang isinya : buku > 2007,majalah terbit II/XI/1989,komik 1978, flyer II/XX/1999 > lalu saya buat script seperti ini : > <? > include "konek.php"; > $sql=mysql_query("select * from tb_contoh"); > $hasil=mysql_fetch_array($sql); > $arr_urut=explode(",",$hasil[urut]); > foreach($arr_urut as $arr_urut) > { > echo "<li>$arr_urut</li><br>"; > } > ?> > > hasilnya seperti ini : > - buku 2007 > - majalah terbit II/XI/1989 > - komik 1978 > - flyer II/XX/1999 > > saya ingin bagaimana supaya hasilnya urut dari tahun yg kecil sampai yg > besar, > - komik 1978 > - majalah terbit II/XI/1989 > - flyer II/XX/1999 > - buku 2007 > > saya cari di google, adanya pakai sort, ksort,asort, tapi yg arraynya agak > spesifik kaya diatas blom dapet tuh > > mungkin teman2 ada yg bisa bantu.. > > thx > > tito > > --------------------------------- > Ahhh...imagining that irresistible "new car" smell? > Check outnew cars at Yahoo! Autos. > > [Non-text portions of this message have been removed] > > > [Non-text portions of this message have been removed] --------------------------------- Ahhh...imagining that irresistible "new car" smell? Check outnew cars at Yahoo! Autos. [Non-text portions of this message have been removed] -- www.itcenter.or.id - Komunitas Teknologi Informasi Indonesia Gabung, Keluar, Mode Kirim : [EMAIL PROTECTED] ## Jobs: itcenter.or.id/jobs ## Bursa: itcenter.or.id/bursa ## ## Jaket ITCENTER tersedia di http://shop.itcenter.or.id Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/ITCENTER/ <*> Your email settings: Individual Email | Traditional <*> To change settings online go to: http://groups.yahoo.com/group/ITCENTER/join (Yahoo! ID required) <*> To change settings via email: mailto:[EMAIL PROTECTED] mailto:[EMAIL PROTECTED] <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/