3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str=<<<XML <database name="newsportal"> <table name="wp_options"> <column name="option_id">1</column> <column name="option_name">siteurl</column> <column name="option_value">http://localhost/newsportal</column> <column name="autoload">yes</column> </table> <table name="wp_options"> <column name="option_id">2</column> <column name="option_name">home</column> <column name="option_value">http://localhost/newsportal</column> <column name="autoload">yes</column> </table> <table name="wp_options"> <column name="option_id">3</column> <column name="option_name">blogname</column> <column name="option_value">News Portal</column> <column name="autoload">yes</column> </table> <table name="wp_options"> <column name="option_id">4</column> <column name="option_name">blogdescription</column> <column name="option_value">Just another WordPress site</column> <column name="autoload">yes</column> </table> </database> XML; $xml=simplexml_load_string($str); $nodes = $xml->xpath("//database//table[@name='wp_options']"); foreach($nodes as $item) { $row = simplexml_load_string($item->asXML()); $v = $row->xpath("//column[@name='option_id'][.=contains('1','2','3')]"); if(count($v) > 0) { foreach($item->column as $column) { echo $column['name'] . '=' . $column . "<br/>"; } //echo $item->column['name']."<br/>"; } }
Output for git.master, git.master_jit
Warning: SimpleXMLElement::xpath(): Invalid number of arguments in /in/4r3TY on line 37 Warning: SimpleXMLElement::xpath(): xmlXPathEval: 5 object left on the stack in /in/4r3TY on line 37 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, bool given in /in/4r3TY:39 Stack trace: #0 {main} thrown in /in/4r3TY on line 39
Process exited with code 255.
Output for rfc.property-hooks
Warning: SimpleXMLElement::xpath(): Invalid number of arguments in /in/4r3TY on line 37 Warning: SimpleXMLElement::xpath(): xmlXPathEval: 5 object left on the stack in /in/4r3TY on line 37 Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, false given in /in/4r3TY:39 Stack trace: #0 {main} thrown in /in/4r3TY on line 39
Process exited with code 255.

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:
50.87 ms | 401 KiB | 8 Q