gratsami Posted November 14, 2008 Share Posted November 14, 2008 I have HTML code and contain some paragraphs ... and i want to strip the first HTML code from this paragraphs.. example: $text = '<p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p>'; i want this output: Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> i know that function make it substr($text, 16); but if the count of character is increased or decreased ... how to know this count automatically and make substr function ?? Quote Link to comment https://forums.phpfreaks.com/topic/132774-solved-i-need-help-in-strip-some-characters-from-text-begining/ Share on other sites More sharing options...
genericnumber1 Posted November 14, 2008 Share Posted November 14, 2008 could always go simple and do <?php $text = '<p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p> <p align="left">Bla Bla Bla Bla Bla </p>'; echo substr($text, strpos($text, '>') + 1); ?> or you could use regexp if this isn't what you intend as it will only remove one html tag (eg. won't remove <p><b>). Quote Link to comment https://forums.phpfreaks.com/topic/132774-solved-i-need-help-in-strip-some-characters-from-text-begining/#findComment-690497 Share on other sites More sharing options...
gratsami Posted November 15, 2008 Author Share Posted November 15, 2008 genericnumber1 thank you very much it's work Quote Link to comment https://forums.phpfreaks.com/topic/132774-solved-i-need-help-in-strip-some-characters-from-text-begining/#findComment-690666 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.