3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ReadXml($xmlstr) { $xml = simplexml_load_string($xmlstr); printXML($xml); } function printXML($xml) { echo $xml->getName(); echo $xml->count() > 1 ? "\n" : ":"; foreach ($xml->children() as $child) { printXML($xml); } echo "\n"; } ReadXml('<Address><to>James</to><from>Jani</from><heading>Reminder</heading><body>Please check your mail.</body></Address>' );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oVdVX
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'readxml'
          1        SEND_VAL                                                 '%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'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function readxml:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oVdVX
function name:  ReadXml
number of ops:  9
compiled vars:  !0 = $xmlstr, !1 = $xml
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'simplexml_load_string'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        ASSIGN                                                   !1, $2
    4     5        INIT_FCALL_BY_NAME                                       'printXML'
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0          
    5     8      > RETURN                                                   null

End of function readxml

Function printxml:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 10
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
Branch analysis from position: 20
filename:       /in/oVdVX
function name:  printXML
number of ops:  23
compiled vars:  !0 = $xml, !1 = $child
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_METHOD_CALL                                         !0, 'getName'
          2        DO_FCALL                                      0  $2      
          3        ECHO                                                     $2
    9     4        INIT_METHOD_CALL                                         !0, 'count'
          5        DO_FCALL                                      0  $3      
          6        IS_SMALLER                                               1, $3
          7      > JMPZ                                                     ~4, ->10
          8    >   QM_ASSIGN                                        ~5      '%0A'
          9      > JMP                                                      ->11
         10    >   QM_ASSIGN                                        ~5      '%3A'
         11    >   ECHO                                                     ~5
   10    12        INIT_METHOD_CALL                                         !0, 'children'
         13        DO_FCALL                                      0  $6      
         14      > FE_RESET_R                                       $7      $6, ->20
         15    > > FE_FETCH_R                                               $7, !1, ->20
   11    16    >   INIT_FCALL_BY_NAME                                       'printXML'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
   10    19      > JMP                                                      ->15
         20    >   FE_FREE                                                  $7
   13    21        ECHO                                                     '%0A'
   14    22      > RETURN                                                   null

End of function printxml

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.52 ms | 1403 KiB | 16 Q