3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str='<li><a href="test1.php">21.03.2017 <ul>Test1</ul> </a><p> <a href="test1"></a> </p> </li> <li><a href="test2.php">21.03.2017 <ul>Text2</ul> </a><p> <a href="test2.php"></a> </p> </li>'; $dom = new DOMDocument; @$dom->loadHTML($str); $aList = $dom->getElementsByTagName('a'); foreach ($aList as $a) { $output[] = array ( 'str' => $a->nodeValue, 'href' => $a->getAttribute('href') ); } var_dump($output);
Output for git.master, git.master_jit, rfc.property-hooks
array(4) { [0]=> array(2) { ["str"]=> string(21) "21.03.2017 Test1" ["href"]=> string(9) "test1.php" } [1]=> array(2) { ["str"]=> string(0) "" ["href"]=> string(5) "test1" } [2]=> array(2) { ["str"]=> string(21) "21.03.2017 Text2" ["href"]=> string(9) "test2.php" } [3]=> array(2) { ["str"]=> string(0) "" ["href"]=> string(9) "test2.php" } }

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.22 ms | 402 KiB | 8 Q