3v4l.org

run code in 300+ PHP versions simultaneously
<?php $count = 50; $start = microtime(true); $y = 0; // for($i = 0; $i < $count; $i++) // { $code = ' $ret = ""; for ($i=0; $i<100; $i++) { $ret.= md5($i.$ret); } return $ret; '; eval($code); // } 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() { // return ++$y; $ret = ''; for ($i=0; $i<100; $i++) { $ret.= md5($i.$ret); } return $ret; }; $f(); // } printf("#2, result is %d, done in %f\n", $y, microtime(true) - $start); $fName = create_function('', $code); $fName(); printf("#3, done in %f\n", microtime(true) - $start); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eLEPp
function name:  (null)
number of ops:  51
compiled vars:  !0 = $count, !1 = $start, !2 = $y, !3 = $code, !4 = $f, !5 = $fName
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                                         $7      
          4        ASSIGN                                                   !1, $7
    4     5        ASSIGN                                                   !2, 0
    7     6        ASSIGN                                                   !3, '%0A++++++++%24ret+%3D+%22%22%3B%0A++++++++for+%28%24i%3D0%3B+%24i%3C100%3B+%24i%2B%2B%29+%7B%0A++++++++++++%24ret.%3D+md5%28%24i.%24ret%29%3B%0A++++++++%7D%0A++++++++return+%24ret%3B%0A'
   14     7        INCLUDE_OR_EVAL                                          !3, EVAL
   17     8        INIT_FCALL                                               'printf'
          9        SEND_VAL                                                 '%231%2C+result+is+%25d%2C+done+in+%25f%0A'
         10        SEND_VAR                                                 !2
         11        INIT_FCALL                                               'microtime'
         12        SEND_VAL                                                 <true>
         13        DO_ICALL                                         $12     
         14        SUB                                              ~13     $12, !1
         15        SEND_VAL                                                 ~13
         16        DO_ICALL                                                 
   19    17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $15     
         20        ASSIGN                                                   !1, $15
   20    21        ASSIGN                                                   !2, 0
   23    22        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeLEPp%3A23%240'
         23        ASSIGN                                                   !4, ~18
   32    24        INIT_DYNAMIC_CALL                                        !4
         25        DO_FCALL                                      0          
   35    26        INIT_FCALL                                               'printf'
         27        SEND_VAL                                                 '%232%2C+result+is+%25d%2C+done+in+%25f%0A'
         28        SEND_VAR                                                 !2
         29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $21     
         32        SUB                                              ~22     $21, !1
         33        SEND_VAL                                                 ~22
         34        DO_ICALL                                                 
   37    35        INIT_FCALL_BY_NAME                                       'create_function'
         36        SEND_VAL_EX                                              ''
         37        SEND_VAR_EX                                              !3
         38        DO_FCALL                                      0  $24     
         39        ASSIGN                                                   !5, $24
   38    40        INIT_DYNAMIC_CALL                                        !5
         41        DO_FCALL                                      0          
   40    42        INIT_FCALL                                               'printf'
         43        SEND_VAL                                                 '%233%2C+done+in+%25f%0A'
         44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $27     
         47        SUB                                              ~28     $27, !1
         48        SEND_VAL                                                 ~28
         49        DO_ICALL                                                 
   42    50      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeLEPp%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 3
Branch analysis from position: 11
Branch analysis from position: 3
filename:       /in/eLEPp
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $ret, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ASSIGN                                                   !0, ''
   27     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->9
   28     3    >   INIT_FCALL                                               'md5'
          4        CONCAT                                           ~4      !1, !0
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                         $5      
          7        ASSIGN_OP                                     8          !0, $5
   27     8        PRE_INC                                                  !1
          9    >   IS_SMALLER                                               !1, 100
         10      > JMPNZ                                                    ~8, ->3
   30    11    > > RETURN                                                   !0
   31    12*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeLEPp%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.21 ms | 1400 KiB | 19 Q