Hey, does anyone know how I can get a text string encapsulated within a special character? Example: $_mytext = "|text1|text2|text3|"; I want to be able to print a list like this: 1. text1 2. text2 3. text3 Please and thanks
Try this <?php $_mytext = "|text1|text2|text3|"; $_mytext = trim($_mytext, '|'); $arr = explode('|', $_mytext); if ($arr != array()) { echo '<ol>'; foreach ($arr as $a) { echo '<li>'.$a.'</li>'; } echo '</ol>'; } ?> PHP: