Previous | Home | Next |
trim()
This function removes the whitespaces from both start and the end of the string.
Syntax :trim("string");
Example:
<?php $str = "Gud Morning!"; echo $str . "<br>"; echo trim($str,"Gug!"); ?>
Output:
Gud Morning! d Mornin
ltrim()
This function removes the whitespaces from the left part of the string.
Syntax :ltrim("string");
Example:
<?php $str = "Gud Morning..!!!"; echo ltrim($str,"Gud"); ?>
Output:
rtrim()
This function removes the whitespaces from the right part of the string.
Syntax :rtrim("string");
Example:
<?php $str = "Gud Morning"; echo rtrim($str,"Morning"); ?>
Output:
Previous | Home | Next |