Search code examples
phpstringhtml-listsexplode

PHP show text up to /*show more text*/


I would like to only show the text that is before /*SHOW MORE TEXT*/ However I am unsure how to do such a thing because my text is like this:

<ul>
<li>show this</li>
<li>show this</li>
/*SHOW MORE TEXT*/
<li>don't show this</li>
</ul>

I have tried

$texts = explode("/*SHOW MORE TEXT*/", $text);

But the issue with this is then it won't fix the </ul>

How can I fix this small issue?


Solution

  • Just try with Jquery toggle functions it's more easier and faster. Here you find details: http://api.jquery.com/toggle/