Cara mengambil atau memilih string
Posted by Jawaad on 6 November, 2008
No comments yet
This item was filled under [ Code Snippet, PHP ]
Cara untuk mengambil atau memilih atau mencomot kalimat tertentu dari database atau text normal.
Contoh isi pada data adalah: NCABZ-2007
Dan kita ingin mengambil hanya 3 huruf mulai dari digit ke 3 sampai 3 karakter.
How to pick a complex string from MySQL.
We can pick a string from MySQL database with various style.
Example, the value from database is NCABZ-2007
And we want only view ABZ
<?php $data = "NCABZ-2007"; $new_data = substr($data, 2 , 3); echo $new_data; // hasilnya: ABZ ?>
hasilnya dari variable $new_data adalah “ABZ“
Popularity: 3,123 views

