stig1 Posted March 3, 2009 Share Posted March 3, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/147810-create-list-from-a-text-string/ Share on other sites More sharing options...
premiso Posted March 3, 2009 Share Posted March 3, 2009 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; Quote Link to comment https://forums.phpfreaks.com/topic/147810-create-list-from-a-text-string/#findComment-775848 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.