Jump to content

Only display the first 40 characters of a string.


jpratt

Recommended Posts

This is how i display a url down to 40 characters in length and it leaves trailing dots at the end
[code]function DisplayURL($url) {
    if (strlen($url) > 40) return(substr($url,0,40) . '...');
    else return($url);
}
...
...
...
echo DisplayURL[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.