3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "<td class='postac'>Actelsar </td> <td class='postac'>tabl. 80 mg 28 tabl.</td> <td class='postac'> 3 &lt; 4</td><td class=\"postac\"> or <td class= 'postac'> or <td class='postac' > or <td class='postac' id='foo'> or <td class='postac'>"; preg_match_all("/<td class='postac'>([^<]+)</", $str,$m); $doc = new DOMDocument(); $doc->loadHTML($str); $xpath = new DOMXPath($doc); $nodes = $xpath->query('//td[@class="postac"]'); $result = array(); for($i=0;$i<$nodes->length; $i++){ $result[]=$nodes->item($i)->textContent; } print_r($m[1]); print_r($result); ?>
Output for 5.0.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Actelsar [1] => tabl. 80 mg 28 tabl. [2] => 3 &lt; 4 ) Array ( [0] => Actelsar [1] => tabl. 80 mg 28 tabl. [2] => 3 < 4 [3] => or [4] => or [5] => or [6] => or [7] => )
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/8tXgA on line 14
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/8tXgA on line 14
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/8tXgA on line 14
Process exited with code 255.