[Phpwm] ltrin inconsistency

David Long dave at longwaveconsulting.com
Fri Jul 28 10:44:00 BST 2006


Phil Beynon wrote:
> Has anyone seen or know the answer to this apparent inconsistency with the
> ltrim() command;
>
> This one always loses either the "51" or "5" as if it was running further
> into the file name.
>
> full = ./75px/tn_51eb_expensivepiss.jpg trimmed = tn_51eb_expensivepiss.jpg
> full = ./150px/51eb_expensivepiss.jpg trimmed = eb_expensivepiss.jpg
> full = ./250px/51eb_expensivepiss.jpg trimmed = 1eb_expensivepiss.jpg
>   
The second parameter to ltrim() (and its friends trim() and rtrim()) is 
a list of characters to trim, not an entire string to remove.

So, in the 150px example, you're losing the 1 and the 5 because they are 
present in the character list "./150px/". The trim then stops because 
"e" is not in the list. In the 250px example, you still lose the 5 but 
trimming stops at the 1 because there is no "1" in "./250px/".

Dave




More information about the Phpwm mailing list