3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $str = "<para>From the New York Times</para> <para>Instacart, a two-year-old grocery delivery company, announced a $44 million round of financing on Monday led by Andreessen Horowitz. Three venture capital firms that previously invested in the company, Sequoia Capital, Khosla Ventures and Canaan Partners, participated in the latest round.</para> <para>The company, which is based in San Francisco, lets customers shop online from grocery stores in their area. The orders are filled by other people who have signed up to be shoppers and who receive a cut of the delivery fees. Information about a store’s inventory comes from store managers and from the shoppers. The company says it can have groceries delivered within an hour.</para>"; $dom = new DOMDocument; $dom->preserveWhiteSpace = false; $dom->formatOutput = true; libxml_use_internal_errors(true); $dom->loadHTML($str, LIBXML_HTML_NODEFDTD | LIBXML_HTML_NOIMPLIED); $xpath = new DOMXPath($dom); $secondPara = $xpath->query('//para[2]'); $secondPara->item(0)->setAttribute('align', 'left'); echo $dom->saveHTML();
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
<para>From the New York Times<para>Instacart, a two-year-old grocery delivery company, announced a $44 million round of financing on Monday led by Andreessen Horowitz. Three venture capital firms that previously invested in the company, Sequoia Capital, Khosla Ventures and Canaan Partners, participated in the latest round.</para><para align="left">The company, which is based in San Francisco, lets customers shop online from grocery stores in their area. The orders are filled by other people who have signed up to be shoppers and who receive a cut of the delivery fees. Information about a store&acirc;&#128;&#153;s inventory comes from store managers and from the shoppers. The company says it can have groceries delivered within an hour.</para></para>
Output for 5.1.0 - 5.3.29
Notice: Use of undefined constant LIBXML_HTML_NODEFDTD - assumed 'LIBXML_HTML_NODEFDTD' in /in/mlItF on line 14 Notice: Use of undefined constant LIBXML_HTML_NOIMPLIED - assumed 'LIBXML_HTML_NOIMPLIED' in /in/mlItF on line 14 Warning: DOMDocument::loadHTML() expects exactly 1 parameter, 2 given in /in/mlItF on line 14 Fatal error: Call to a member function setAttribute() on a non-object in /in/mlItF on line 18
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function libxml_use_internal_errors() in /in/mlItF on line 13
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/mlItF on line 18
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/mlItF on line 18
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/mlItF on line 18
Process exited with code 255.