PHP String Trim Chop And Length – String Function

 
    <?
$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 />");
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.