chrille112 wrote:Hi!
Try this:
$string = "Habbla habbla php rocks";
$NUM_WORDS = 2;
$tmp = explode(' ', $string);
for($i=0; $i<$NUM_WORDS; $i++)
echo $tmp[$i].' ';
works good! actually I also tried with
substr("$row[field_name]", 0, 200)
which has
pros : no error if field has less than 200 characters
cons : works on characters, so it displays only some characters of the last word..
So I'm using yours! 😃
Thanks!