$text = '<p>Download game <a href="">Avatar</a> for <b>Iphone 3GS</b></p>';
<?php
echo strip_tags(substr($text, 0, 10))." ...";
?>
But resut is ....
How to fix it?
As pointed out the $text variable declaration needs to be within the PHP section.
Also I'd suggest that you strip_tags first and then substr the result as otherwise strip_tags won't be able to remove all of the tags.
i.e:
<?php
$text = '<p>Download game <a href="">Avatar</a> for <b>Iphone 3GS</b></p>';
echo substr(strip_tags($text), 0, 10)." ...";
and even possibly as follows: so you'd get Download game Avatar ...Iphone 3GS
<?php
$text = '<p>Download game <a href="">Avatar</a> for <b>Iphone 3GS</b></p>';
$ntext = strip_tags($text);
echo substr($ntext, 0, 20).
(strlen($ntext) > 20 ? "...".substr($ntext, min(20,strlen($ntext)-10)):"");