disi akan di tampilkan script penggantian karakter dengan fungsi str_replace()
$badchars = array('/', '-', '&', ')', '(', '"', '.', '!', '?');
str_replace($badchars,'',$title);
str_replace(', ',', and ',$title);
$title=str_replace(':','', str_replace(';','', str_replace('/','', str_replace('-','', str_replace('&','', str_replace(')','', str_replace('(','', str_replace('"','', str_replace('.','', str_replace('!','', str_replace('?','', str_replace(' ',' ', str_replace(' ',', ',trim($title))))))))))))))
function makeLine($str) {
$a = explode(', ', $str);
for($i=0; $i<count($a)-1; $i++) {
$tmp.= $a[$i].', ';
}
$tmp = substr($tmp, 0, strlen($tmp)-2);
$tmp.= ' and '.$a[count($a)-1];
return $tmp;
}
Try:
$before ='This is a sentence )*(a(B*Z&abc%QER12356';
$after = preg_replace( '/[^a-zA-Z]/', '', $before);
echo $before.'<br />'.$after.'<br />';
to get
This is a sentence )*(a(B*Z&abc%QER12356
ThisisasentenceaBZabcQER
or add a space to the pattern to keep the spacing between the words
$after = preg_replace( '/[^a-zA-Z ]/', '', $before);
echo $before.'<br />'.$after.'<br />';
to get
This is a sentence )*(a(B*Z&abc%QER12356
This is a sentence aBZabcQER
ANDA INGIN Info????, silahkan Klik :
Info Hotel di Bali
Blajar PHP
Mau Buat Aplikasi WEB
Bola
Bola Mania
Info Bola
Donload MP3 Free
Check Kesehatan anda
Berita Hari Ini
Daftar Nama-nama Hotel
Musik Jadul
Tentang Alam
Harga HP
MOTO GP
NETWORK
Desa'ku
NETWORK Bali
Cinta KU
Motor Plus
Ngopi
Kelamin anda
Donload Tragedi Dunia
Bibirnya Gosip
Laptop Ku
Tanamanku
Virus MU