3v4l.org

run code in 300+ PHP versions simultaneously
<?php set_time_limit(0); echo "<pre>"; // Pure array no copy function m1($a, $b) { $var = null; if ($a == 1) { if ($b == 1) { $var = 'test'; } } return $var; } // Array clean copy function m2($a, $b) { $var = null; if ($a == 1 && $b == 1) { $var = 'test'; } return $var; } $result = array( 'm1' => 0, 'm2' => 0 ); // asset assert(m2(0, 0) == m1(0, 0)); assert(m2(1, 1) == m1(1, 1)); for($i = 0; $i < 100000; ++ $i) { foreach(array_keys($result) as $key) { $alpha = microtime(true); $key(1,1); $result[$key] += microtime(true) - $alpha; } } echo '<pre>'; echo "Single Run\n"; print_r($result); echo '</pre>'; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 35
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
2 jumps found. (Code = 77) Position 1 = 39, Position 2 = 55
Branch analysis from position: 39
2 jumps found. (Code = 78) Position 1 = 40, Position 2 = 55
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
Branch analysis from position: 55
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 35
Branch analysis from position: 59
Branch analysis from position: 35
Branch analysis from position: 55
filename:       /in/4I2cd
function name:  (null)
number of ops:  66
compiled vars:  !0 = $result, !1 = $i, !2 = $key, !3 = $alpha
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'set_time_limit'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
    3     3        ECHO                                                     '%3Cpre%3E'
   27     4        ASSIGN                                                   !0, <array>
   34     5        ASSERT_CHECK                                             
          6        INIT_FCALL                                               'assert'
          7        INIT_FCALL                                               'm2'
          8        SEND_VAL                                                 0
          9        SEND_VAL                                                 0
         10        DO_FCALL                                      0  $6      
         11        INIT_FCALL                                               'm1'
         12        SEND_VAL                                                 0
         13        SEND_VAL                                                 0
         14        DO_FCALL                                      0  $7      
         15        IS_EQUAL                                         ~8      $6, $7
         16        SEND_VAL                                                 ~8
         17        SEND_VAL                                                 'assert%28m2%280%2C+0%29+%3D%3D+m1%280%2C+0%29%29'
         18        DO_ICALL                                                 
   35    19        ASSERT_CHECK                                             
         20        INIT_FCALL                                               'assert'
         21        INIT_FCALL                                               'm2'
         22        SEND_VAL                                                 1
         23        SEND_VAL                                                 1
         24        DO_FCALL                                      0  $10     
         25        INIT_FCALL                                               'm1'
         26        SEND_VAL                                                 1
         27        SEND_VAL                                                 1
         28        DO_FCALL                                      0  $11     
         29        IS_EQUAL                                         ~12     $10, $11
         30        SEND_VAL                                                 ~12
         31        SEND_VAL                                                 'assert%28m2%281%2C+1%29+%3D%3D+m1%281%2C+1%29%29'
         32        DO_ICALL                                                 
   37    33        ASSIGN                                                   !1, 0
         34      > JMP                                                      ->57
   38    35    >   INIT_FCALL                                               'array_keys'
         36        SEND_VAR                                                 !0
         37        DO_ICALL                                         $15     
         38      > FE_RESET_R                                       $16     $15, ->55
         39    > > FE_FETCH_R                                               $16, !2, ->55
   39    40    >   INIT_FCALL                                               'microtime'
         41        SEND_VAL                                                 <true>
         42        DO_ICALL                                         $17     
         43        ASSIGN                                                   !3, $17
   40    44        INIT_DYNAMIC_CALL                                        !2
         45        SEND_VAL_EX                                              1
         46        SEND_VAL_EX                                              1
         47        DO_FCALL                                      0          
   41    48        INIT_FCALL                                               'microtime'
         49        SEND_VAL                                                 <true>
         50        DO_ICALL                                         $21     
         51        SUB                                              ~22     $21, !3
         52        ASSIGN_DIM_OP                +=               1          !0, !2
         53        OP_DATA                                                  ~22
   38    54      > JMP                                                      ->39
         55    >   FE_FREE                                                  $16
   37    56        PRE_INC                                                  !1
         57    >   IS_SMALLER                                               !1, 100000
         58      > JMPNZ                                                    ~24, ->35
   45    59    >   ECHO                                                     '%3Cpre%3E'
   46    60        ECHO                                                     'Single+Run%0A'
   47    61        INIT_FCALL                                               'print_r'
         62        SEND_VAR                                                 !0
         63        DO_ICALL                                                 
   48    64        ECHO                                                     '%3C%2Fpre%3E'
   50    65      > RETURN                                                   1

Function m1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
Branch analysis from position: 8
filename:       /in/4I2cd
function name:  m1
number of ops:  10
compiled vars:  !0 = $a, !1 = $b, !2 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        ASSIGN                                                   !2, null
    8     3        IS_EQUAL                                                 !0, 1
          4      > JMPZ                                                     ~4, ->8
    9     5    >   IS_EQUAL                                                 !1, 1
          6      > JMPZ                                                     ~5, ->8
   10     7    >   ASSIGN                                                   !2, 'test'
   13     8    > > RETURN                                                   !2
   14     9*     > RETURN                                                   null

End of function m1

Function m2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
Branch analysis from position: 7
filename:       /in/4I2cd
function name:  m2
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $var
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        ASSIGN                                                   !2, null
   21     3        IS_EQUAL                                         ~4      !0, 1
          4      > JMPZ_EX                                          ~4      ~4, ->7
          5    >   IS_EQUAL                                         ~5      !1, 1
          6        BOOL                                             ~4      ~5
          7    > > JMPZ                                                     ~4, ->9
   22     8    >   ASSIGN                                                   !2, 'test'
   24     9    > > RETURN                                                   !2
   25    10*     > RETURN                                                   null

End of function m2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.5 ms | 1398 KiB | 27 Q