Thursday, 12 September 2013

PHP trim entire words

PHP trim entire words

How to trim entire words from php string
like I dont want "foo", "bar", "mouse" words on left and "killed" on the
end of string.
So "fo awesome illed" would not be trimmed
But "foo awesome killed" => " awesome "
"killed awesome foo" not trimmed (killed trimmed from right, rest from left)
When I'm using ltrim($str, "foo"); it will trim any letter from "foo" -
"f" or "o"

No comments:

Post a Comment