Useful Functions

PHP T-ShirtAt various times I develop Functions for use in sites to accomplish special formats or show unusual items. I’ve shown here some of those functions I have developed and your are free to use them wherever you’d like.

All I ask in return is that if you do use one of them, please give me credit for having written the code with something like this in the credits section above the function code:

/**
 * @author: Chris Anderson — c h r i s @ c l a b s c o . c o m
 * @author URL: http://www.clabsco.com
 */

Truncate Strings by Length, Word Count

Use this function to limit or truncate a string to a specified number of characters or word count, or both. In the case of defining both criteria, the word count is applied first then the character length is applied. Paste the following code into your Functions page (and be sure to load it before you attempt to call it from your code) or on the page you use this function. /** * @function: $Id: tah_truncate_string

Back to Top

The Anderson Home