How to get data from html?

How to get yesand no from html?
the <body>Hello<br><br>FFDGJHIJHFMVDFF.<br>Grtrvfwrwerwerffdsf.<br><br>Active? the <br>=&gt; yes &lt;=<br><br <br=""><br>Active? the <br>=&gt; no &lt;=<br><br>Lalalalal.<br><br>
</body>


here is the output:
5e120448c3256406973499.png

I think that you need to find the html elements => <=and pull what is inside them.
Can't figure out how to make preg_match query
April 4th 20 at 00:51
2 answers
April 4th 20 at 00:53
Solution
@Kathryn.Ruecker c using regexps:
$str = '<body>Hello<br><br>FFDGJHIJHFMVDFF.<br>Grtrvfwrwerwerffdsf.<br><br>Active? the <br>=&gt; yes &lt;=<br><br <br=""><br>Active? the <br>=&gt; no &lt;=<br><br>Lalalalal.<br><br>
</body>';

$arr = preg_match_all('~=&gt;\h\K.+?(?=\h&lt;=)~', $str, $arr) ? $arr[0] : [];

var_dump($arr);
/*
array(2) {
 [0]=> string(3) "yes"
 [1]=> string(2) "no"
}
*/
April 4th 20 at 00:55
Break the string into fragments using a delimiter => using the function explode. The output will get an array where all elements except the element with index 0 contains the beginning of the string before characters <= the data you want.

Find more questions by tags PHP