I recently had several uses for this function, and there are probably many out. I am not proclaiming this unique nor the best available, but it works which is what counts. I actually took the majority of it from someone else, I think from php.net, but I tweaked it a little bit.
Pass in the string, and optionally, the length you want to curb it to. You can set a default in the highlighted section of the code (currently set at 100). Right now it returns it with a “…” at the end, which is what I wanted. Go ahead and remove the second highlighted section of the code if you don’t want this. (The highlights are very small – look hard! Squint if you must.)-Kerry
Share and Enjoy:
(No Ratings Yet)
Loading ...
This entry was posted
on Tuesday, September 18th, 2007 at 7:35 pm and is filed under PHP, Phoenix Development.
You can follow any responses to this entry through the RSS 2.0 feed.
You can leave a response, or trackback from your own site.
Leave a reply