Monday, December 21, 2009

How do you remove the last letter from a string?

There are many ways to do this. An interviewer will be looking for you to use a compact method. Here is probably the simplest method:

$data = "One too many letterss";
$newdata = substr($data,0,-1);// now 'one too many letters'

No comments:

Post a Comment

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off