Switch to full style
:read: Start PHP with us. Includes topics to help you in php
Post a reply

Trimming Strings in php

Sun Oct 26, 2008 10:27 pm

Code:

<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>





Post a reply
  Related Posts  to : Trimming Strings in php
 Sort strings java-Sorting Array of Strings     -  
 C++ Strings     -  
 PHP Strings     -  
 compare two strings     -  
 Use Switch with strings     -  
 compare strings     -  
 Compare two strings in php     -  
 compare strings with if statement in php     -  
 Iterate on array of strings     -  
 Help with selection sort for strings?     -  

Topic Tags

PHP Strings