09-08-2007, 01:15 AM
|
#3 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,324
Thanks: 5
|
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 $szOutput? It is assigned a value and immediately the next line is the return.
- Speaking of the return, why is $szOutput 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 $iLength, 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.
|
|
|
|