[Tip] Limiting a strings length
View Single Post
09-08-2007, 12:15 AM
Join Date: Apr 2007
It's a very simple function, but I'm going to be picky (it's late here and this is what I do when I'm tired).
Why do you create
? It is assigned a value and immediately the next line is the return.
Speaking of the return, why is
trimmed just before returning if the string is limited, but not in any other case?
This is my main gripe, the actual length of the returned value (if the string has been trimmed) is
$iLength + strlen($szAffix)
. The returned string should be of length
, not greater. What's the point of limiting to, say, 20 characters when the actual string returned is 23?
The function, as is, has a syntax error -- line 6, the last parenthesis shouldn't be there.
View Public Profile
Send a private message to Salathe
Visit Salathe's homepage!
Find More Posts by Salathe