3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ReadXml(string $xmlstr) { $xmlElement = simplexml_load_string($xmlstr); $return = ""; $return .= $xmlElement->getName(); foreach($xmlElement->children() as $key => $child) { $return .= $key.": ".$child."\n"; } return $return; } $xmlstr = '<Address><to>James</to><from>Jani</from><heading>Reminder</heading><body>Please check your mail.</body></Address>'; echo ReadXml($xmlstr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/39BSP
function name:  (null)
number of ops:  6
compiled vars:  !0 = $xmlstr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, '%3CAddress%3E%3Cto%3EJames%3C%2Fto%3E%3Cfrom%3EJani%3C%2Ffrom%3E%3Cheading%3EReminder%3C%2Fheading%3E%3Cbody%3EPlease+check+your+mail.%3C%2Fbody%3E%3C%2FAddress%3E'
   15     1        INIT_FCALL                                               'readxml'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Function readxml:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 19
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/39BSP
function name:  ReadXml
number of ops:  22
compiled vars:  !0 = $xmlstr, !1 = $xmlElement, !2 = $return, !3 = $child, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    5     5        ASSIGN                                                   !2, ''
    6     6        INIT_METHOD_CALL                                         !1, 'getName'
          7        DO_FCALL                                      0  $8      
          8        ASSIGN_OP                                     8          !2, $8
    7     9        INIT_METHOD_CALL                                         !1, 'children'
         10        DO_FCALL                                      0  $10     
         11      > FE_RESET_R                                       $11     $10, ->19
         12    > > FE_FETCH_R                                       ~12     $11, !3, ->19
         13    >   ASSIGN                                                   !4, ~12
    8    14        CONCAT                                           ~14     !4, '%3A+'
         15        CONCAT                                           ~15     ~14, !3
         16        CONCAT                                           ~16     ~15, '%0A'
         17        ASSIGN_OP                                     8          !2, ~16
    7    18      > JMP                                                      ->12
         19    >   FE_FREE                                                  $11
   10    20      > RETURN                                                   !2
   11    21*     > RETURN                                                   null

End of function readxml

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.18 ms | 1399 KiB | 16 Q