String trim chop and length : String Trim Chop « String « PHP






String trim chop and length


<?
$original = "  AAAAAAA       ";
$chopped = chop($original);
$ltrimmed = ltrim($original);
$trimmed = trim($original);

print("The original is '$original'<BR>");
print("Its length is " . strlen($original) . "<BR>");
print("The chopped version is '$chopped'<BR>");
print("Its length is " . strlen($chopped) . "<BR>");
print("The ltrimmed version is '$ltrimmed'<BR>");
print("Its length is " . strlen($ltrimmed) . "<BR>");
print("The trimmed version is '$ltrimmed'<BR>");
print("Its length is " . strlen($trimmed) . "<BR>");
?>
           
       








Related examples in the same category

1.Trim only tab and newline characters from $str
2.Trimming Strings: ltrim
3.Trimming Strings: trim
4.Trimming Strings for 'tab' and 'return'
5.Specify the characters in charlist by giving their hexadecimal value