bone282 commented on a Page, Truncation  -  Feb 24, 2011

One little tweek to make it a little faster is to use isset() instead of strlen(). This is because isset() is a language construct and not a function.

if ($l >= strlen($n)) return $n;
to:
if (!isset($n{$l})) return $n;

note using $string{$length} counts from zero.

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.