Cleaning Up a String with trim(), Itrim(), and strip_tags() : rtrim « String « PHP






Cleaning Up a String with trim(), Itrim(), and strip_tags()

 
<?php
$text = "\t\t\tlots of room";
$text = trim( $text );
print $text;
?>

==
keep white space at the beginning of a string but remove it from the end. 

<?php
$text = "\t\t\tlots of room  ";
$text = rtrim( $text );
print $text;
?>
  
  








Related examples in the same category

1.string rtrim ( string str [, string trim_chars] ) only trims whitespace from the righthand side of a string.