PHP

PHP Menu

PHP

ltrim() Function - Definition, Syntax, Parameters, Examples

Definition

The ltrim() function removes whitespace or other predefined characters from the left side of a string.

Syntax

ltrim(string, charlist)

Parameters

Parameter Description
string Required. Specifies the string to check.
charlist Optional. Specifies which characters to remove from the string. If omitted, all of the following characters are removed:
"\0" - null
"\t" - tab
"\n" - new line
"\x0B" - vertical tab
"\r" - carriage return
" " - ordinary white space.

Example

<?php
$str = " Hello World!"; echo ltrim($str);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods