Jump to content

create list from a text string...


stig1

Recommended Posts

Hopefully this is a very simple question.

 

I have a text string and I would like to convert the text string into a list.

 

For example:

 

$subtypeDesc = "Made from quality thermal paper treated on one side to produce an image from heat. These rolls are wound with the treated side out, which suits most machines. They are measured width of paper x diameter of roll x inside diameter of core.";[code]

I would like to break the string at the full stop (.). I would assume you would have to then delete the space after the full stop before creating the next <li>.

Thanks in advance for your help.

Link to comment
https://forums.phpfreaks.com/topic/147810-create-list-from-a-text-string/
Share on other sites

Not sure what you mean, but I bet explode and implode are what you are after.

 

$subtypeDesc = "Made from quality thermal paper treated on one side to produce an image from heat. These rolls are wound with the treated side out, which suits most machines. They are measured width of paper x diameter of roll x inside diameter of core.";
$subtypes = explode(".", $subtypeDesc);
implode("</li><li>", $subtypes);
echo $subtypes;

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.