Jumat, 21 Mei 2010

How to remove excess whitespaces from a string?

I was looking for a small and quick way to remove excess whitespaces from a string. Sometimes you get SQL statement (or any other string) with whitespaces and need to clean it before your function starts to work with it.For example: $sql = "SELECT id, field1, field2 .... FROM table WHERE status = 1";And after trying some ways we found, that using preg_replace() function is

Tidak ada komentar:

Posting Komentar