3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = <<<XML <Property> <images> <image number="1"> <image>http://www.blah.net/shared/depot/3168/biens/149506/images/627783.jpg </image> <image number="2"> <image>http://www.blah.net/shared/depot/3168/biens/149506/images/627794.jpg</image> </image> <image number="3"> <image>http://www.blah.net/shared/depot/3168/biens/149506/images/627792.jpg </image> </images> </Property> XML; $xml = simplexml_load_string($xmlstr); //var_dump($xml); foreach ($xml->images->image as $image) { // create an array $images with number as index and url as value var_dump ($image); //$i=$image['number']; $images[$i]=(string)$image; } var_dump($images); ?>
Output for 8.3.0 - 8.3.4
Warning: simplexml_load_string(): Entity: line 12: parser error : expected '>' in /in/ieI9J on line 18 Warning: simplexml_load_string(): </images> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Opening and ending tag mismatch: image line 3 and Property in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag images line 2 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag Property line 1 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: Attempt to read property "images" on false in /in/ieI9J on line 22 Warning: Attempt to read property "image" on null in /in/ieI9J on line 22 Warning: foreach() argument must be of type array|object, null given in /in/ieI9J on line 22 Warning: Undefined variable $images in /in/ieI9J on line 30 NULL
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17
Warning: simplexml_load_string(): Entity: line 12: parser error : expected '>' in /in/ieI9J on line 18 Warning: simplexml_load_string(): </images> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Opening and ending tag mismatch: image line 3 and Property in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag images line 2 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag Property line 1 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: Attempt to read property "images" on bool in /in/ieI9J on line 22 Warning: Attempt to read property "image" on null in /in/ieI9J on line 22 Warning: foreach() argument must be of type array|object, null given in /in/ieI9J on line 22 Warning: Undefined variable $images in /in/ieI9J on line 30 NULL
Output for 7.3.16 - 7.3.31, 7.4.3 - 7.4.33
Warning: simplexml_load_string(): Entity: line 12: parser error : expected '>' in /in/ieI9J on line 18 Warning: simplexml_load_string(): </images> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Opening and ending tag mismatch: image line 3 and Property in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag images line 2 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag Property line 1 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Notice: Trying to get property 'images' of non-object in /in/ieI9J on line 22 Notice: Trying to get property 'image' of non-object in /in/ieI9J on line 22 Warning: Invalid argument supplied for foreach() in /in/ieI9J on line 22 Notice: Undefined variable: images in /in/ieI9J on line 30 NULL
Output for 7.3.32 - 7.3.33
Warning: simplexml_load_string(): Entity: line 12: parser error : expected '>' in /in/ieI9J on line 18 Warning: simplexml_load_string(): </images> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Opening and ending tag mismatch: image line 3 and Property in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag images line 2 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: simplexml_load_string(): Entity: line 13: parser error : Premature end of data in tag Property line 1 in /in/ieI9J on line 18 Warning: simplexml_load_string(): </Property> in /in/ieI9J on line 18 Warning: simplexml_load_string(): ^ in /in/ieI9J on line 18 Warning: Invalid argument supplied for foreach() in /in/ieI9J on line 22 NULL
Output for 7.2.29 - 7.2.33
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting '-' or identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /in/ieI9J on line 26
Process exited with code 255.
Output for 5.4.13
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in /in/6Dt1p on line 26
Process exited with code 255.
Output for 5.4.0 - 5.4.12
Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in ieI9J on line 26
Process exited with code 255.
Output for 5.3.23
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /in/6Dt1p on line 26
Process exited with code 255.
Output for 5.3.0 - 5.3.22
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ieI9J on line 26
Process exited with code 255.

preferences:
157.08 ms | 401 KiB | 174 Q