Dec 23, 2003, 10:31 PM
Post #4 of 4
Re: [Recall] Opposite of Chop?
[In reply to]
Anyway, AFAIK there is no built in function but you can use a couple of other methods...
substr($string, 0, 1) = '' if ($string and length($string));
why do you do the tests for the second answer but not the first?
what happens in the first case if $string starts with "\n"? it needs the /s modifier for . to match \n
and in the second, what if $string is '0'?
that first test needs to be defined($string).
also, 4 arg substr is faster than lvalue substr.