I am working on a small php script I have an html code like this :
<p>text1</p> <p>text2</p> <p>text3</p>
Is it possible to use php to get only the content of the first paragraph which is text1 ?
I am working on a small php script I have an html code like this :
<p>text1</p> <p>text2</p> <p>text3</p>
Is it possible to use php to get only the content of the first paragraph which is text1 ?
Yes, is possible:
$text = '<p>text1</p> <p>text2</p> <p>text3</p>';
$text = preg_replace('/<\/p>[ ]{1,}<p>/', '</p><p>', $text);
$splitedText = explode('</p>', $text);
var_dump(substr($splitedText[0],3));
I Hope this helps!