basically trying to take a string that is over 35 characters and prune anything over 25 characters with a ... while most lines work there seems to be a problem on lines with really long words not neccessarily in the range of the wordwrap, when this happens it doesnt seem to prune at all if (strlen($row['Descr']) > 35) { $newdescr = wordwrap($row['Descr'], 25, ""); $newdescr = preg_replace("/^(.*)(.*)$/", "$1...", $newdescr); trim($newdescr); } else { $newdescr = $row['Descr']; }