If you are trying to do a page, or section of news that only shows a certain length of characters, and then has a link for Read Full Story, or more..., etc the following code is just what you need:
$longtext = "Full text string to be manipulated"; // I want mine to cut off text after 255 chars $shorttext = substr($longtext,0,255); $space = strrpos($shorttext," "); $newtext = substr($shorttext,0,$space); echo "$newtext <a href=more_details.php>more...</a>";
Note: I'm posting a few of these code snippets just for general reference. They are somewhat old, so please feel free to make updates, suggestions for this code. I'm posting them mainly for the benefit of newer PHP programmers. :)
After I get settled in, and have a little more time, I'll make updates to these next few threads, and sit down, and put together some tutorials that are more up to date.