A Really Really Dumb Question

A

Anonymous

Guest
Hi

What function do I use to return the leftmost n characters of a string? In all (well most) other languages I have used have some kind of function that will do this. For example
LEFT(string,numofchars)

I have looked thru the online PHP manual & I can't seem to find a function that will do this.

Sorry to have to ask a dumb question like this. Can anyone give me a clue?

cheers
MaxDax
 
If you want to do any sort of string manipulation or access, the section of the manual is (surprise!) Strings. The function you're looking for is the venerable substr().
 
Magic!
Thanks swirlee.
I've got no excuse for not remembering that one. I'll go stand in the corner for 10 mins :oops:
MaxDax
 
Back
Top