PDA

View Full Version : Using strlen for limited characters...


kona72
04-17-2007, 11:36 PM
Hi All ,

I am trying to have my code pull only the 10 characters from a row in a table but i am having all kinds of problems.

Can some one have a look at my code and critique it?



<?php echo $row_rsIndex['content'];
if ((strlen($content) > 10) && (strlen($content) > 1)) { $content = substr("$content", 0, 10)."... ";} ?>




THANKS!!!

kona72
04-18-2007, 01:28 AM
Hey,

Got it cased....


<?php echo substr($row_rsIndex['content'],0,10); ?> Read More...</a>



Apparently I was barking up the wrong tree...

davidj
04-18-2007, 06:40 AM
nice one

its the old chestnut substr