3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(("" =='')); var_dump(("" ==='')); var_dump((" " ==' ')); var_dump((" " ===' ')); die; $string = <<<XML <?xml version="1.0" encoding="UTF-8"?> <datapacket packet_type="send_data" version="3.15.3.15" level="1" reg_number="705" ogrn="1027808757899" mac_address="50:46:5D:4E:F7:06" comp_name="k415-1" interval_end_date="2015-03-26 14:12:53"> <teachers> <teacher teacher_id="705000000208" fio="Яловенко Любовь Николаевна" uid=""/> <teacher teacher_id="705000000211" fio="Шкарубо Людмила Ивановна" uid=""/> <teacher teacher_id="705000000214" fio="Шибаева Оксана Викторовна" uid=""/> <teacher_delete teacher_id="705000000214" fio="Шибаева Оксана Викторовна" uid=""/> <teacher_delete teacher_id="705000000214" fio="Шибаева Оксана Викторовна" uid=""/> </teachers> <last_marks> <last_mark last_mark_id="705000111240"/> <last_mark last_mark_id="705000111240"/> <last_mark_deleted last_mark_id="705000111240"/> <last_mark_deleted last_mark_id="705000144740"/> <last_mark_deleted last_mark_id="705000200530"/> </last_marks> </datapacket> XML; $xml = simplexml_load_string($string); foreach($xml->children()->children() as $nodeName => $child) { var_dump($child); $child = $child->attributes(); var_dump($child); $child = $child['@attributes']; var_dump($child); die; } die; $xml = new SimpleXMLElement($string); $result = $xml->xpath('teachers'); var_dump($result); die; while(list( , $node) = each($result)) { echo '/teachers: ',$node,"\n"; } /* Относительные пути также работают... */ $result = $xml->xpath('b/c'); while(list( , $node) = each($result)) { echo 'b/c: ',$node,"\n"; } ?>
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.24 - 5.5.35, 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.1.25 - 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.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
bool(true) bool(true) bool(true) bool(true)
Output for 7.1.10

Process exited with code 137.
Output for 4.4.3 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/2LV7f on line 31
Process exited with code 255.
Output for 4.4.2
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/2LV7f on line 32
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/2LV7f on line 31
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/2LV7f on line 31
Process exited with code 255.

preferences:
281.32 ms | 401 KiB | 355 Q