Trimming Strings: chop : String Case « String « PHP






Trimming Strings: chop

<html>
<head>
<title>Trim Functions</title>
</head>
<body>
<span>
<?php
     $TrailingSpaces = "Trailing Spaces             ";
     $Leadingspaces = "             Leading spaces";
     $TrailingAndLeadingSpaces = "            Trailing and Leading Spaces         ";
     $TabString = $HTTP_USER_AGENT . "  \n\n\n      \t\t \r\r";
   
     print("\"$TrailingSpaces\"" . "<br />");
     print("\"$Leadingspaces\"" . "<br />");
     print("\"$TrailingAndLeadingSpaces\"" . "<br />");
     print("\"$TabString\"" . "<br />");
   
     $TrailingSpaces = chop($TrailingSpaces);
     $Leadingspaces = ltrim($Leadingspaces);
     $TrailingAndLeadingSpaces = trim($TrailingAndLeadingSpaces);
     $TabString = trim($TabString);
   
     print("<br/>");
   
     print("\"$TrailingSpaces\"" . "<br />");
     print("\"$Leadingspaces\"" . "<br />");
     print("\"$TrailingAndLeadingSpaces\"" . "<br />");
     print("\"$TabString\"" . "<br />");
?>
</span>
</body>
</html>

           
       








Related examples in the same category

1.ucwords() function capitalizes the first letter of each word in a string
2.Change String case to lower
3.Initial-capping words is a very common task
4.Change String case to Upper