3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 50; $start = microtime(true); $y = 0; for($i = 0; $i < $count; $i++) { eval('++$y;'); } printf("#1, result is %d, done in %f\n", $y, microtime(true) - $start); $start = microtime(true); $y = 0; for($i = 0; $i < $count; $i++) { $f = function() use (&$y) { return ++$y; }; $f(); } printf("#2, result is %d, done in %f\n", $y, microtime(true) - $start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 8
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 28
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 36, Position 2 = 28
Branch analysis from position: 36
Branch analysis from position: 28
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 8
Branch analysis from position: 12
Branch analysis from position: 8
filename:       /in/vDom1
function name:  (null)
number of ops:  46
compiled vars:  !0 = $count, !1 = $start, !2 = $y, !3 = $i, !4 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 50
    3     1        INIT_FCALL                                               'microtime'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
    4     5        ASSIGN                                                   !2, 0
    5     6        ASSIGN                                                   !3, 0
          7      > JMP                                                      ->10
    7     8    >   INCLUDE_OR_EVAL                                          '%2B%2B%24y%3B', EVAL
    5     9        PRE_INC                                                  !3
         10    >   IS_SMALLER                                               !3, !0
         11      > JMPNZ                                                    ~12, ->8
   10    12    >   INIT_FCALL                                               'printf'
         13        SEND_VAL                                                 '%231%2C+result+is+%25d%2C+done+in+%25f%0A'
         14        SEND_VAR                                                 !2
         15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $13     
         18        SUB                                              ~14     $13, !1
         19        SEND_VAL                                                 ~14
         20        DO_ICALL                                                 
   12    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $16     
         24        ASSIGN                                                   !1, $16
   13    25        ASSIGN                                                   !2, 0
   14    26        ASSIGN                                                   !3, 0
         27      > JMP                                                      ->34
   16    28    >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FvDom1%3A16%240'
         29        BIND_LEXICAL                                             ~20, !2
         30        ASSIGN                                                   !4, ~20
   20    31        INIT_DYNAMIC_CALL                                        !4
         32        DO_FCALL                                      0          
   14    33        PRE_INC                                                  !3
         34    >   IS_SMALLER                                               !3, !0
         35      > JMPNZ                                                    ~24, ->28
   23    36    >   INIT_FCALL                                               'printf'
         37        SEND_VAL                                                 '%232%2C+result+is+%25d%2C+done+in+%25f%0A'
         38        SEND_VAR                                                 !2
         39        INIT_FCALL                                               'microtime'
         40        SEND_VAL                                                 <true>
         41        DO_ICALL                                         $25     
         42        SUB                                              ~26     $25, !1
         43        SEND_VAL                                                 ~26
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FvDom1%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vDom1
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   BIND_STATIC                                              !0
   18     1        PRE_INC                                          ~1      !0
          2      > RETURN                                                   ~1
   19     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FvDom1%3A16%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.66 ms | 1405 KiB | 17 Q