|
Posted by Richard Davey on 06/27/05 19:29
Hello Stut,
Monday, June 27, 2005, 4:59:17 PM, you wrote:
>> 0-8 is nine characters, which is two less than eleven, IIRC
S> So the length should be 9 not 8 no? Or should I go back to school?
It should be 9 if you want 9 characters.
Lots of PHP functions are zero-based, but the 3rd parameter to substr
is asking for the number of characters to return, not the actual
character location in the string to stop at - if it did, then it would
have been 8 (0 being the 1st character, etc), but in this case it's 9.
It's an easy one to slip-up on imho.
Best regards,
Richard Davey
--
http://www.launchcode.co.uk - PHP Development Services
"I do not fear computers. I fear the lack of them." - Isaac Asimov
[Back to original message]
|