Oleh : Abah Razi
بسم الله الرحمن الرحيم
Untuk hanya menghilangkan spasi, gunakan str_replace:
[code language=”php”]
$string = str_replace(‘ ‘, ”, $string);
[/code]
Untuk menghilangkan seluruh whitespace, gunakan preg_replace:
[code language=”php”]
$string = preg_replace(‘/\s+/’, ”, $string);
[/code]
Leave a Reply