/Tag: shorten-string

PHP Shorten (Truncate) Text / Strings

By |2014-01-05T10:25:33+00:00March 8th, 2012|Code, PHP|

Just a simple function to take any given string and just shorten it. Sometimes you have an column in your DB thats a few paragraphs long but the page you want to display a snippet of the column only has room for 50 characters (or however many you can spare).\r\n\r\nAn example would be:\r\n […]