3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array(); $l = 50; for($i = 0; $i< $l; $i++) { $array[$i] = md5($i); } $copy = $array; $start = microtime(true); for($i = 0; $i< $l; $i++) { $copy[$i] = $copy[$i] . ' x'; } echo "\nfor:" . microtime(true) - $start; $copy = $array; $start = microtime(true); foreach ($copy as $i => $item) { $copy[$i] = $item . ' x'; } echo "\nforeach (ohne ref):" . (microtime(true) - $start); $copy = $array; $start = microtime(true); foreach ($copy as &$item) { $item .= ' x'; } echo "\nforeach (ohne ref):" . (microtime(true) - $start); $copy = $array; $start = microtime(true); array_walk($copy, function (&$item, $i) { $item .= ' x'; }); echo "\narray_walk (mit ref):" . (microtime(true) - $start); $copy = $array; $start = microtime(true); $copy = array_map(function ($item) { $item .= ' x'; }, $copy); echo "\narray_map (mit ref):" . (microtime(true) - $start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 4
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 19
Branch analysis from position: 26
2 jumps found. (Code = 77) Position 1 = 38, Position 2 = 44
Branch analysis from position: 38
2 jumps found. (Code = 78) Position 1 = 39, Position 2 = 44
Branch analysis from position: 39
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 44
2 jumps found. (Code = 125) Position 1 = 57, Position 2 = 60
Branch analysis from position: 57
2 jumps found. (Code = 126) Position 1 = 58, Position 2 = 60
Branch analysis from position: 58
1 jumps found. (Code = 42) Position 1 = 57
Branch analysis from position: 57
Branch analysis from position: 60
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 60
Branch analysis from position: 44
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 26, Position 2 = 19
Branch analysis from position: 26
Branch analysis from position: 19
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 4
Branch analysis from position: 12
Branch analysis from position: 4
filename:       /in/H2tDG
function name:  (null)
number of ops:  101
compiled vars:  !0 = $array, !1 = $l, !2 = $i, !3 = $copy, !4 = $start, !5 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 50
    4     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->10
    5     4    >   INIT_FCALL                                               'md5'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $10     
          7        ASSIGN_DIM                                               !0, !2
          8        OP_DATA                                                  $10
    4     9        PRE_INC                                                  !2
         10    >   IS_SMALLER                                               !2, !1
         11      > JMPNZ                                                    ~12, ->4
    8    12    >   ASSIGN                                                   !3, !0
    9    13        INIT_FCALL                                               'microtime'
         14        SEND_VAL                                                 <true>
         15        DO_ICALL                                         $14     
         16        ASSIGN                                                   !4, $14
   10    17        ASSIGN                                                   !2, 0
         18      > JMP                                                      ->24
   11    19    >   FETCH_DIM_R                                      ~18     !3, !2
         20        CONCAT                                           ~19     ~18, '+x'
         21        ASSIGN_DIM                                               !3, !2
         22        OP_DATA                                                  ~19
   10    23        PRE_INC                                                  !2
         24    >   IS_SMALLER                                               !2, !1
         25      > JMPNZ                                                    ~21, ->19
   13    26    >   INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $22     
         29        SUB                                              ~23     $22, !4
         30        CONCAT                                           ~24     '%0Afor%3A', ~23
         31        ECHO                                                     ~24
   16    32        ASSIGN                                                   !3, !0
   17    33        INIT_FCALL                                               'microtime'
         34        SEND_VAL                                                 <true>
         35        DO_ICALL                                         $26     
         36        ASSIGN                                                   !4, $26
   18    37      > FE_RESET_R                                       $28     !3, ->44
         38    > > FE_FETCH_R                                       ~29     $28, !5, ->44
         39    >   ASSIGN                                                   !2, ~29
   19    40        CONCAT                                           ~32     !5, '+x'
         41        ASSIGN_DIM                                               !3, !2
         42        OP_DATA                                                  ~32
   18    43      > JMP                                                      ->38
         44    >   FE_FREE                                                  $28
   21    45        INIT_FCALL                                               'microtime'
         46        SEND_VAL                                                 <true>
         47        DO_ICALL                                         $33     
         48        SUB                                              ~34     $33, !4
         49        CONCAT                                           ~35     '%0Aforeach+%28ohne+ref%29%3A', ~34
         50        ECHO                                                     ~35
   24    51        ASSIGN                                                   !3, !0
   25    52        INIT_FCALL                                               'microtime'
         53        SEND_VAL                                                 <true>
         54        DO_ICALL                                         $37     
         55        ASSIGN                                                   !4, $37
   26    56      > FE_RESET_RW                                      $39     !3, ->60
         57    > > FE_FETCH_RW                                              $39, !5, ->60
   27    58    >   ASSIGN_OP                                     8          !5, '+x'
   26    59      > JMP                                                      ->57
         60    >   FE_FREE                                                  $39
   29    61        INIT_FCALL                                               'microtime'
         62        SEND_VAL                                                 <true>
         63        DO_ICALL                                         $41     
         64        SUB                                              ~42     $41, !4
         65        CONCAT                                           ~43     '%0Aforeach+%28ohne+ref%29%3A', ~42
         66        ECHO                                                     ~43
   32    67        ASSIGN                                                   !3, !0
   33    68        INIT_FCALL                                               'microtime'
         69        SEND_VAL                                                 <true>
         70        DO_ICALL                                         $45     
         71        ASSIGN                                                   !4, $45
   34    72        INIT_FCALL                                               'array_walk'
         73        SEND_REF                                                 !3
         74        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FH2tDG%3A34%240'
   36    75        SEND_VAL                                                 ~47
         76        DO_ICALL                                                 
   37    77        INIT_FCALL                                               'microtime'
         78        SEND_VAL                                                 <true>
         79        DO_ICALL                                         $49     
         80        SUB                                              ~50     $49, !4
         81        CONCAT                                           ~51     '%0Aarray_walk+%28mit+ref%29%3A', ~50
         82        ECHO                                                     ~51
   40    83        ASSIGN                                                   !3, !0
   41    84        INIT_FCALL                                               'microtime'
         85        SEND_VAL                                                 <true>
         86        DO_ICALL                                         $53     
         87        ASSIGN                                                   !4, $53
   42    88        INIT_FCALL                                               'array_map'
         89        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FH2tDG%3A42%241'
   44    90        SEND_VAL                                                 ~55
         91        SEND_VAR                                                 !3
         92        DO_ICALL                                         $56     
   42    93        ASSIGN                                                   !3, $56
   45    94        INIT_FCALL                                               'microtime'
         95        SEND_VAL                                                 <true>
         96        DO_ICALL                                         $58     
         97        SUB                                              ~59     $58, !4
         98        CONCAT                                           ~60     '%0Aarray_map+%28mit+ref%29%3A', ~59
         99        ECHO                                                     ~60
        100      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FH2tDG%3A34%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H2tDG
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $item, !1 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   35     2        ASSIGN_OP                                     8          !0, '+x'
   36     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FH2tDG%3A34%240

Function %00%7Bclosure%7D%2Fin%2FH2tDG%3A42%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H2tDG
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   43     1        ASSIGN_OP                                     8          !0, '+x'
   44     2      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FH2tDG%3A42%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.1 ms | 1396 KiB | 21 Q