-2

I am using ltrim function. I run this code :

echo ltrim("looooooooooooooooooooooooongWord","long");

i expect to get this word : looooooooooooooooooooooooongWord but it prints Word.

what's the problem ?

Edit: I thought it remove the word long, but it appears it remove the l,o,n,g characters !

david
  • 3,310
  • 7
  • 36
  • 59
  • 2
    Please take effort in reading the PHP documentation, the functions' description is quite clear in this. It's a "character mask" – tvgemert Jun 03 '15 at 14:57

2 Answers2

3

ltrim — Strip whitespace (or other characters) from the beginning of a string

It does exactly as it says, strips chars l, o, n, g.

Andrey
  • 59,039
  • 12
  • 119
  • 163
2

From the docs: (please read them).

string ltrim ( string $str [, string $character_mask ] )

str

The input string.

character_mask

You can also specify the characters you want to strip, by means of the character_mask parameter. Simply list all characters that you want to be stripped. With .. you can specify a range of characters.

Daan
  • 12,099
  • 6
  • 34
  • 51