PHP tutorial-String manipulation |
||||||||||||||
String manipulation in PHPtrim, ltrim, and rtrim functions trim, ltrim, and rtrim functions are used to remove space from a string. -trim(String) removes leading and trailing space from the string. -ltrim(String) removes leading spaces. -rtrim(String) removes trailing spaces. Example: <?php $str=" PHP web development "; echo trim($str)."<br>";//remove spaces at the beginning and the end echo ltrim($str)."<br>";//remove spaces at the beginning only echo rtrim($str)."<br>";//remove spaces at the end only ?> |
| |||||||||||||
|
||||||||||||||