3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 10000; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { foreach($array as $key => $val) { $function($val, $key); } } echo 'foreach: '.(microtime(true) - $t).'\n'; $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo 'array_walk: '.(microtime(true) - $t).'\n'; $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array, array_keys($array)); } echo 'array_map: '.(microtime(true) - $t).'\n';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 39
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 59
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 59
Branch analysis from position: 70
Branch analysis from position: 59
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 46, Position 2 = 39
Branch analysis from position: 46
Branch analysis from position: 39
Branch analysis from position: 14
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 22
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 14
Branch analysis from position: 26
Branch analysis from position: 14
Branch analysis from position: 22
filename:       /in/opVc8
function name:  (null)
number of ops:  78
compiled vars:  !0 = $iter, !1 = $array, !2 = $function, !3 = $t, !4 = $i, !5 = $val, !6 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 10000
    4     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 0
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $8      
          5        ASSIGN                                                   !1, $8
    5     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FopVc8%3A5%240'
          7        ASSIGN                                                   !2, ~10
    7     8        INIT_FCALL                                               'microtime'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $12     
         11        ASSIGN                                                   !3, $12
    8    12        ASSIGN                                                   !4, 0
         13      > JMP                                                      ->24
   10    14    > > FE_RESET_R                                       $15     !1, ->22
         15    > > FE_FETCH_R                                       ~16     $15, !5, ->22
         16    >   ASSIGN                                                   !6, ~16
   12    17        INIT_DYNAMIC_CALL                                        !2
         18        SEND_VAR_EX                                              !5
         19        SEND_VAR_EX                                              !6
         20        DO_FCALL                                      0          
   10    21      > JMP                                                      ->15
         22    >   FE_FREE                                                  $15
    8    23        PRE_INC                                                  !4
         24    >   IS_SMALLER                                               !4, !0
         25      > JMPNZ                                                    ~20, ->14
   15    26    >   INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $21     
         29        SUB                                              ~22     $21, !3
         30        CONCAT                                           ~23     'foreach%3A+', ~22
         31        CONCAT                                           ~24     ~23, '%5Cn'
         32        ECHO                                                     ~24
   17    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $25     
         36        ASSIGN                                                   !3, $25
   18    37        ASSIGN                                                   !4, 0
         38      > JMP                                                      ->44
   20    39    >   INIT_FCALL                                               'array_walk'
         40        SEND_REF                                                 !1
         41        SEND_VAR                                                 !2
         42        DO_ICALL                                                 
   18    43        PRE_INC                                                  !4
         44    >   IS_SMALLER                                               !4, !0
         45      > JMPNZ                                                    ~30, ->39
   22    46    >   INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $31     
         49        SUB                                              ~32     $31, !3
         50        CONCAT                                           ~33     'array_walk%3A+', ~32
         51        CONCAT                                           ~34     ~33, '%5Cn'
         52        ECHO                                                     ~34
   24    53        INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $35     
         56        ASSIGN                                                   !3, $35
   25    57        ASSIGN                                                   !4, 0
         58      > JMP                                                      ->68
   27    59    >   INIT_FCALL                                               'array_map'
         60        SEND_VAR                                                 !2
         61        SEND_VAR                                                 !1
         62        INIT_FCALL                                               'array_keys'
         63        SEND_VAR                                                 !1
         64        DO_ICALL                                         $38     
         65        SEND_VAR                                                 $38
         66        DO_ICALL                                                 
   25    67        PRE_INC                                                  !4
         68    >   IS_SMALLER                                               !4, !0
         69      > JMPNZ                                                    ~41, ->59
   29    70    >   INIT_FCALL                                               'microtime'
         71        SEND_VAL                                                 <true>
         72        DO_ICALL                                         $42     
         73        SUB                                              ~43     $42, !3
         74        CONCAT                                           ~44     'array_map%3A+', ~43
         75        CONCAT                                           ~45     ~44, '%5Cn'
         76        ECHO                                                     ~45
         77      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FopVc8%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/opVc8
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $val, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FopVc8%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.4 ms | 1404 KiB | 23 Q