How to remove white space in PHP (remove spaces at begining and end of string)?

You can remove trailing and leading white characters in PHP. What is white character ? it's just a character wich we don't see like tab, space, or new line character. To remove white space characters in PHP just use trim() function. It will do the work, here comes two sample codes:$trimmed = trim( $somestring ); echo "[".trim(" hello ")."]"; As you can see you can use this function inline to for example filter output.

Comments

Popular posts from this blog

How to show only month and year fields in android Date-picker?

How to construct a B+ tree with example

Conflict Serializability in database