I trying to get a clean paragraph to be displayed on the website but, because of the <p></p>
in the middle of the content I am not getting the expected output. I have tried the following but none of them worked and I am still getting <p></p>
around my content.
$story = "<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p><p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>";
1. $story = strip_tags($story, '<p>');
2. $story=str_ireplace('<p>','',$story);
3. $story=str_ireplace('</p>','',$story);
4. $story = preg_replace('/<p\b[^>]*>(.*?)<\/p>/i', '', $story);
Have I missed anything in my code? My expected output would be
Answer: Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
` html tag and no other HTML tag?
– nice_dev Feb 15 '19 at 06:24` as the second argument to `strip_tags()`, you're telling the function to _allow_ that tag, not to remove it. If you want to strip all tags, just omit the second argument. If you want to keep other html tags, that's the ones you should pass as a second argument. [Here's the manual](http://php.net/manual/en/function.strip-tags.php)
– M. Eriksson Feb 15 '19 at 06:24` tag from the content($story).
– Alisha Lamichhane Feb 15 '19 at 06:26