3v4l.org

run code in 300+ PHP versions simultaneously
<?php $iter = 1000; $array = range(0, $iter); $function = function($val, $key) {}; $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_walk($array, $function); } echo 'array_walk '.($walk = microtime(true) - $t); $t = microtime(true); for($i = 0; $i < $iter; $i++) { array_map($function, $array, array_keys($array)); } echo ', array_map '.($map = microtime(true) - $t); echo ', '.(100 - $walk / $map * 100).'%';
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 14
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 34
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 34
Branch analysis from position: 45
Branch analysis from position: 34
Branch analysis from position: 14
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 14
Branch analysis from position: 21
Branch analysis from position: 14
filename:       /in/lD69M
function name:  (null)
number of ops:  59
compiled vars:  !0 = $iter, !1 = $array, !2 = $function, !3 = $t, !4 = $i, !5 = $walk, !6 = $map
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, 1000
    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%2FlD69M%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                                                      ->19
   10    14    >   INIT_FCALL                                               'array_walk'
         15        SEND_REF                                                 !1
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
    8    18        PRE_INC                                                  !4
         19    >   IS_SMALLER                                               !4, !0
         20      > JMPNZ                                                    ~17, ->14
   12    21    >   INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $18     
         24        SUB                                              ~19     $18, !3
         25        ASSIGN                                           ~20     !5, ~19
         26        CONCAT                                           ~21     'array_walk+', ~20
         27        ECHO                                                     ~21
   14    28        INIT_FCALL                                               'microtime'
         29        SEND_VAL                                                 <true>
         30        DO_ICALL                                         $22     
         31        ASSIGN                                                   !3, $22
   15    32        ASSIGN                                                   !4, 0
         33      > JMP                                                      ->43
   17    34    >   INIT_FCALL                                               'array_map'
         35        SEND_VAR                                                 !2
         36        SEND_VAR                                                 !1
         37        INIT_FCALL                                               'array_keys'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                         $25     
         40        SEND_VAR                                                 $25
         41        DO_ICALL                                                 
   15    42        PRE_INC                                                  !4
         43    >   IS_SMALLER                                               !4, !0
         44      > JMPNZ                                                    ~28, ->34
   19    45    >   INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $29     
         48        SUB                                              ~30     $29, !3
         49        ASSIGN                                           ~31     !6, ~30
         50        CONCAT                                           ~32     '%2C+array_map+', ~31
         51        ECHO                                                     ~32
   21    52        DIV                                              ~33     !5, !6
         53        MUL                                              ~34     ~33, 100
         54        SUB                                              ~35     100, ~34
         55        CONCAT                                           ~36     '%2C+', ~35
         56        CONCAT                                           ~37     ~36, '%25'
         57        ECHO                                                     ~37
         58      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FlD69M%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lD69M
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%2FlD69M%3A5%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.2 ms | 1400 KiB | 23 Q