Why does LTRIM() behave weird sometimes?

Why does LTRIM() behave weird sometimes?

Checkout this code http://codepad.org/RuvO3Z8x

Can someone please tell me the reason?

It’s removing the characters a d m i n, not the word admin from the left.

It isn’t behaving weird.

It just isn’t doing what you think it should be doing.

From
http://php.net/manual/en/function.ltrim.php

string ltrim ( string $str [, string $character_mask ] )
Strip whitespace (or other characters) from the beginning of a 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.

i.e. it isn’t a str_replace but more like a regex character class

EDIT
ninja’d again

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.