Jump to content

How do I display the first 100 characters of a record?


poleposters

Recommended Posts

<?php

$mess="my name is redarrow i love php so much man";

$res=substr($mess,0,19); // 0 means start from 1 to example 19...

echo $res;

?>

 

you need this awell i thort mate

 

<?php

$mess="my name is redarrow i love php so much man";

$res=wordwrap($mess,19,'<br>');// make a br at charecter 19..

echo $res;

?>

Great!

 

Thanks, but I just realised I need to do one more thing.

 

I'm using FCK editor to include HTML tags in the description. So my description. Looks like this.

 

<p>my name is redarrow i love php so much man</p>

<p> my name is poleposters and I also love php</p>

 

I need the tags so that my users can create their own formatting for their description. But I don't want to include paragraphs in the preview. Is there a way to remove the tags?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.