Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use trim() Function in php ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 153
    Comment on it

    Why we use trim() Function in php ?

    The trim() function mainly use for removes the spaces from the beginning and the end of the string. trim() function will divest and control characters such as :

    " " an ordinary space.

    "\t" a tab.

    "\n" a new line

    "\r" a carriage return.

    You can see below example of trim() function.

      <?php
          $TitleNamae = "Jurasic World!";
          //here $TitleNamae variable 
    
          echo $TitleNamae . "<br>";
          //echo  full string
          echo trim($TitleNamae,"Jud!");
          //here call trim() to remove beginning and the end of the string 
          //Jurasic World!( "Ju" in "Jurasic" and "d!" in "World!") 
          ?>
    

    So when we will echo the output then,

    Output will come

      Jurasic World!
      rasic Worl
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: