Jump to content

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;

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.