Saturday 26 July 2014

Filled Under:

ltrim() function in php

ltrim() Function :

                               ltrim() function which remove the specific character from the left side the string or remove the white spaces from the left side of the string.

Syntax:

          ltrim(string, specific character);     specific character is optional if we don’t use it then it remove the white space from the left side.

Example:

<?php$str= “hello php”.”<br/>”;
$str2= “        hello php”;
echo  ltrim($str,”hello”);echo ltrim($str);?>

Output:

           hello php
           hello php
the other function is rtrim and trim. rtrim is use to remove the spaces from the right side or specific character from right side and trim function is use to remove the space from both side or remove the specific character from both side of the string.




0 comments:

Post a Comment