3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = new \SimpleXMLElement(' <blog-post> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <dc:tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> <tag xmlns:dc="http://purl.org/dc/elements/1.1/"/> </blog-post>' ); $t = microtime(1); for ($i = 0; $i<100000; $i++){ count($xml->xpath('*')); } var_dump(microtime(1)-$t); $t = microtime(1); for ($i = 0; $i<100000; $i++){ $xml->count(); isset($xml->children()->tag); $xml->children()->tag; } var_dump(microtime(1)-$t);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 31
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 44, Position 2 = 31
Branch analysis from position: 44
Branch analysis from position: 31
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 18, Position 2 = 10
Branch analysis from position: 18
Branch analysis from position: 10
filename:       /in/f5r5i
function name:  (null)
number of ops:  52
compiled vars:  !0 = $xml, !1 = $t, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $3      'SimpleXMLElement'
          1        SEND_VAL_EX                                              '%0A++++%3Cblog-post%3E%0A++++++++%3Cdc%3Atag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Ctag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Cdc%3Atag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Ctag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Cdc%3Atag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Ctag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Cdc%3Atag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Ctag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Cdc%3Atag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Ctag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Cdc%3Atag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++++++%3Ctag+xmlns%3Adc%3D%22http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F%22%2F%3E%0A++++%3C%2Fblog-post%3E'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   18     4        INIT_FCALL                                               'microtime'
          5        SEND_VAL                                                 1
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !1, $6
   19     8        ASSIGN                                                   !2, 0
          9      > JMP                                                      ->16
   20    10    >   INIT_METHOD_CALL                                         !0, 'xpath'
         11        SEND_VAL_EX                                              '%2A'
         12        DO_FCALL                                      0  $9      
         13        COUNT                                            ~10     $9
         14        FREE                                                     ~10
   19    15        PRE_INC                                                  !2
         16    >   IS_SMALLER                                               !2, 100000
         17      > JMPNZ                                                    ~12, ->10
   22    18    >   INIT_FCALL                                               'var_dump'
         19        INIT_FCALL                                               'microtime'
         20        SEND_VAL                                                 1
         21        DO_ICALL                                         $13     
         22        SUB                                              ~14     $13, !1
         23        SEND_VAL                                                 ~14
         24        DO_ICALL                                                 
   24    25        INIT_FCALL                                               'microtime'
         26        SEND_VAL                                                 1
         27        DO_ICALL                                         $16     
         28        ASSIGN                                                   !1, $16
   25    29        ASSIGN                                                   !2, 0
         30      > JMP                                                      ->42
   26    31    >   INIT_METHOD_CALL                                         !0, 'count'
         32        DO_FCALL                                      0          
   27    33        INIT_METHOD_CALL                                         !0, 'children'
         34        DO_FCALL                                      0  $20     
         35        ISSET_ISEMPTY_PROP_OBJ                           ~21     $20, 'tag'
         36        FREE                                                     ~21
   28    37        INIT_METHOD_CALL                                         !0, 'children'
         38        DO_FCALL                                      0  $22     
         39        FETCH_OBJ_R                                      ~23     $22, 'tag'
         40        FREE                                                     ~23
   25    41        PRE_INC                                                  !2
         42    >   IS_SMALLER                                               !2, 100000
         43      > JMPNZ                                                    ~25, ->31
   30    44    >   INIT_FCALL                                               'var_dump'
         45        INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 1
         47        DO_ICALL                                         $26     
         48        SUB                                              ~27     $26, !1
         49        SEND_VAL                                                 ~27
         50        DO_ICALL                                                 
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.81 ms | 1400 KiB | 17 Q