Dear friends i would like to discuss the features of PHP trim functions.
1.trim
We all are familiar with trim. Normally trim is using for removing whitespce from starting or ending of a string, but do you know we can remove words or characters from starting and ending of a string using trim?
Try this Example
$str = "Hello Welcomes";
echo trim($str,'Hels');
2.ltrim
ltrim is using from stripping whitespaces or characters or word from begining of a string.
Try this Example
$str = "Hello Welcomes";
echo ltrim($str, "Hels");
3.rtrim
rtrim is using from stripping whitespaces or characters or word from begining of a string. chop function is a alias of rtrim.
Try this Example
$str = "Hello Welcomes";
echo rtrim($str,'ems');
Hope all you like this article.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment