3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = '<?xml version="1.0" encoding="utf-8"?> <root total="450" count="4" start="0"> <Code>0</Code> <Item><Person.P_Id>14845</Person.P_Id></Item> <Item><Person.P_Id>14844</Person.P_Id></Item> <Item><Person.P_Id>14837</Person.P_Id></Item> <Item><Person.P_Id>14836</Person.P_Id></Item> </root>'; $xml = simplexml_load_string($xmlstr); $itemobjs = $xml->xpath('//Item'); print_r($itemobjs); $items = array_map(function ($v) { return (string)$v->{'Person.P_Id'}; }, $itemobjs); print_r($items);
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.14, 8.5.0
Array ( [0] => SimpleXMLElement Object ( [Person.P_Id] => 14845 ) [1] => SimpleXMLElement Object ( [Person.P_Id] => 14844 ) [2] => SimpleXMLElement Object ( [Person.P_Id] => 14837 ) [3] => SimpleXMLElement Object ( [Person.P_Id] => 14836 ) ) Array ( [0] => 14845 [1] => 14844 [2] => 14837 [3] => 14836 )
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.

preferences:
187.59 ms | 408 KiB | 5 Q