PHP ltrim() Function
In this chapter you will learn:
- Definition for PHP ltrim() Function
- Syntax for PHP ltrim() Function
- Parameter for PHP ltrim() Function
- Return for PHP ltrim() Function
- Example - trim a string from left
Definition
The ltrim()
function trims whitespace from the lefthand side of a string.
Syntax
PHP ltrim() Function has the following syntax.
string ltrim ( string str [, string trim_chars] )
Parameter
The optional second parameter to trim() sets the individual characters you want it to trim.
Return
PHP ltrim() Function returns the left trimmed string.
Example
Trim a string from left
<?PHP//from j a va2 s .c om
$string = ltrim(" java2s.com ");
print( ">"+$string+"<");
?>
The code above generates the following result.
Next chapter...
What you will learn in the next chapter:
- Definition for PHP md5() Function
- Syntax for PHP md5() Function
- Parameter for PHP md5() Function
- Return for PHP md5() Function
- Example - Get the checksum for a string
Home » PHP Tutorial » PHP String Functions