3v4l.org

run code in 300+ PHP versions simultaneously
<?php $testBase = array_fill(0, 100000, 'testdata'); echo "Test array count: " . count($testBase) . PHP_EOL; for($x = 0; $x < 10; $x++ ) { echo "Test #$x" . PHP_EOL; /* foreach test */ $testCopy = array(); $before = microtime(true); foreach ($testBase as $key => $value) { $testCopy[$key] = $value . 'asdasd'; } $after = microtime(true); $dif = $after - $before; echo "foreach test ($before, $after): $dif" . PHP_EOL; /* array_walk test */ $testCopy = $testBase; $before2 = microtime(true); array_walk($testCopy, function(&$value, $key) { $value = $value . 'qweqwe'; }); $after2 = microtime(true); $dif2 = $after2 - $before2; echo "array_walk test ($before2, $after2): $dif2" . PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 12
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 70, Position 2 = 12
Branch analysis from position: 70
Branch analysis from position: 12
Branch analysis from position: 28
filename:       /in/eKS9l
function name:  (null)
number of ops:  71
compiled vars:  !0 = $testBase, !1 = $x, !2 = $testCopy, !3 = $before, !4 = $value, !5 = $key, !6 = $after, !7 = $dif, !8 = $before2, !9 = $after2, !10 = $dif2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 100000
          3        SEND_VAL                                                 'testdata'
          4        DO_ICALL                                         $11     
          5        ASSIGN                                                   !0, $11
    4     6        COUNT                                            ~13     !0
          7        CONCAT                                           ~14     'Test+array+count%3A+', ~13
          8        CONCAT                                           ~15     ~14, '%0A'
          9        ECHO                                                     ~15
    6    10        ASSIGN                                                   !1, 0
         11      > JMP                                                      ->68
    7    12    >   NOP                                                      
         13        FAST_CONCAT                                      ~17     'Test+%23', !1
         14        CONCAT                                           ~18     ~17, '%0A'
         15        ECHO                                                     ~18
   11    16        ASSIGN                                                   !2, <array>
   12    17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $20     
         20        ASSIGN                                                   !3, $20
   13    21      > FE_RESET_R                                       $22     !0, ->28
         22    > > FE_FETCH_R                                       ~23     $22, !4, ->28
         23    >   ASSIGN                                                   !5, ~23
   14    24        CONCAT                                           ~26     !4, 'asdasd'
         25        ASSIGN_DIM                                               !2, !5
         26        OP_DATA                                                  ~26
   13    27      > JMP                                                      ->22
         28    >   FE_FREE                                                  $22
   16    29        INIT_FCALL                                               'microtime'
         30        SEND_VAL                                                 <true>
         31        DO_ICALL                                         $27     
         32        ASSIGN                                                   !6, $27
   17    33        SUB                                              ~29     !6, !3
         34        ASSIGN                                                   !7, ~29
   18    35        ROPE_INIT                                     6  ~32     'foreach+test+%28'
         36        ROPE_ADD                                      1  ~32     ~32, !3
         37        ROPE_ADD                                      2  ~32     ~32, '%2C+'
         38        ROPE_ADD                                      3  ~32     ~32, !6
         39        ROPE_ADD                                      4  ~32     ~32, '%29%3A+'
         40        ROPE_END                                      5  ~31     ~32, !7
         41        CONCAT                                           ~35     ~31, '%0A'
         42        ECHO                                                     ~35
   21    43        ASSIGN                                                   !2, !0
   22    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $37     
         47        ASSIGN                                                   !8, $37
   23    48        INIT_FCALL                                               'array_walk'
         49        SEND_REF                                                 !2
         50        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FeKS9l%3A23%240'
   25    51        SEND_VAL                                                 ~39
         52        DO_ICALL                                                 
   26    53        INIT_FCALL                                               'microtime'
         54        SEND_VAL                                                 <true>
         55        DO_ICALL                                         $41     
         56        ASSIGN                                                   !9, $41
   27    57        SUB                                              ~43     !9, !8
         58        ASSIGN                                                   !10, ~43
   28    59        ROPE_INIT                                     6  ~46     'array_walk+test+%28'
         60        ROPE_ADD                                      1  ~46     ~46, !8
         61        ROPE_ADD                                      2  ~46     ~46, '%2C+'
         62        ROPE_ADD                                      3  ~46     ~46, !9
         63        ROPE_ADD                                      4  ~46     ~46, '%29%3A+'
         64        ROPE_END                                      5  ~45     ~46, !10
         65        CONCAT                                           ~49     ~45, '%0A'
         66        ECHO                                                     ~49
    6    67        PRE_INC                                                  !1
         68    >   IS_SMALLER                                               !1, 10
         69      > JMPNZ                                                    ~51, ->12
   29    70    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FeKS9l%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eKS9l
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $value, !1 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   24     2        CONCAT                                           ~2      !0, 'qweqwe'
          3        ASSIGN                                                   !0, ~2
   25     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FeKS9l%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.55 ms | 1400 KiB | 19 Q