CodeBlog.ch


Smart text trimming with PHP

Posted in PHP, Uncategorized by Remo Laubacher on the June 20th, 2009

Have you ever tried to create a short preview text using PHP? Did you just count the characters and ended up having texts with a completely different width like shown on this picture?

text-trimming

This tutorial describes a small method which calculates the real width of a string and lets you create better looking preview texts!

(more…)