3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = range(1,1000000); $t = microtime(true); foreach($a as $e) { $b = $e; } $t -= microtime(true); echo 'foreach time: ', $t, PHP_EOL; $t = microtime(true); array_walk($a, function($e) { $b = $e; }); $t -= microtime(true); echo 'array_walk time: ', $t, PHP_EOL; $t = microtime(true); array_map(function($e) { $b = $e; }, $a); $t -= microtime(true); echo 'Array_map time: ', $t, PHP_EOL;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/JidLc
function name:  (null)
number of ops:  54
compiled vars:  !0 = $a, !1 = $t, !2 = $e, !3 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'range'
          1        SEND_VAL                                                 1
          2        SEND_VAL                                                 1000000
          3        DO_ICALL                                         $4      
          4        ASSIGN                                                   !0, $4
    4     5        INIT_FCALL                                               'microtime'
          6        SEND_VAL                                                 <true>
          7        DO_ICALL                                         $6      
          8        ASSIGN                                                   !1, $6
    5     9      > FE_RESET_R                                       $8      !0, ->13
         10    > > FE_FETCH_R                                               $8, !2, ->13
         11    >   ASSIGN                                                   !3, !2
         12      > JMP                                                      ->10
         13    >   FE_FREE                                                  $8
    6    14        INIT_FCALL                                               'microtime'
         15        SEND_VAL                                                 <true>
         16        DO_ICALL                                         $10     
         17        ASSIGN_OP                                     2          !1, $10
    7    18        ECHO                                                     'foreach+time%3A+'
         19        ECHO                                                     !1
         20        ECHO                                                     '%0A'
    9    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $12     
         24        ASSIGN                                                   !1, $12
   10    25        INIT_FCALL                                               'array_walk'
         26        SEND_REF                                                 !0
         27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJidLc%3A10%240'
         28        SEND_VAL                                                 ~14
         29        DO_ICALL                                                 
   11    30        INIT_FCALL                                               'microtime'
         31        SEND_VAL                                                 <true>
         32        DO_ICALL                                         $16     
         33        ASSIGN_OP                                     2          !1, $16
   12    34        ECHO                                                     'array_walk+time%3A+'
         35        ECHO                                                     !1
         36        ECHO                                                     '%0A'
   14    37        INIT_FCALL                                               'microtime'
         38        SEND_VAL                                                 <true>
         39        DO_ICALL                                         $18     
         40        ASSIGN                                                   !1, $18
   15    41        INIT_FCALL                                               'array_map'
         42        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FJidLc%3A15%241'
         43        SEND_VAL                                                 ~20
         44        SEND_VAR                                                 !0
         45        DO_ICALL                                                 
   16    46        INIT_FCALL                                               'microtime'
         47        SEND_VAL                                                 <true>
         48        DO_ICALL                                         $22     
         49        ASSIGN_OP                                     2          !1, $22
   18    50        ECHO                                                     'Array_map+time%3A+'
         51        ECHO                                                     !1
         52        ECHO                                                     '%0A'
         53      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FJidLc%3A10%240

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

End of function %00%7Bclosure%7D%2Fin%2FJidLc%3A15%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.79 ms | 1400 KiB | 21 Q