3v4l.org

run code in 300+ PHP versions simultaneously
<?php // The test considers that the array may be associative $arrayExample = array_fill(0, 1000, 'hello'); $testsCount = 1000; $start = microtime(true); for ($i = 0; $i < $testsCount; ++$i) { $array = array_reverse($arrayExample); foreach ($array as $value) { // } } printf("array_reverse: %fs\n", microtime(true) - $start); $start = microtime(true); for ($i = 0; $i < $testsCount; ++$i) { $array = array_values($arrayExample); for ($j = count($array) - 1; $j >= 0; --$j) { $value = $array[$j]; } } printf("array_values %fs\n", microtime(true) - $start); $start = microtime(true); for ($i = 0; $i < $testsCount; ++$i) { $array = $arrayExample; while ($array) { $value = array_pop($array); } } printf("array_pop: %fs\n", microtime(true) - $start);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 13
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 38
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 76
Branch analysis from position: 76
2 jumps found. (Code = 44) Position 1 = 78, Position 2 = 68
Branch analysis from position: 78
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 74
Branch analysis from position: 74
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 70
Branch analysis from position: 75
2 jumps found. (Code = 44) Position 1 = 78, Position 2 = 68
Branch analysis from position: 78
Branch analysis from position: 68
Branch analysis from position: 70
2 jumps found. (Code = 44) Position 1 = 75, Position 2 = 70
Branch analysis from position: 75
Branch analysis from position: 70
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 49
Branch analysis from position: 49
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 46
Branch analysis from position: 51
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 38
Branch analysis from position: 54
Branch analysis from position: 38
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 46
Branch analysis from position: 51
Branch analysis from position: 46
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 20
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 20
2 jumps found. (Code = 44) Position 1 = 24, Position 2 = 13
Branch analysis from position: 24
Branch analysis from position: 13
Branch analysis from position: 20
filename:       /in/3jaTT
function name:  (null)
number of ops:  87
compiled vars:  !0 = $arrayExample, !1 = $testsCount, !2 = $start, !3 = $i, !4 = $array, !5 = $value, !6 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'array_fill'
          1        SEND_VAL                                                 0
          2        SEND_VAL                                                 1000
          3        SEND_VAL                                                 'hello'
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !0, $7
    6     6        ASSIGN                                                   !1, 1000
    8     7        INIT_FCALL                                               'microtime'
          8        SEND_VAL                                                 <true>
          9        DO_ICALL                                         $10     
         10        ASSIGN                                                   !2, $10
    9    11        ASSIGN                                                   !3, 0
         12      > JMP                                                      ->22
   10    13    >   INIT_FCALL                                               'array_reverse'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !4, $13
   11    17      > FE_RESET_R                                       $15     !4, ->20
         18    > > FE_FETCH_R                                               $15, !5, ->20
         19    > > JMP                                                      ->18
         20    >   FE_FREE                                                  $15
    9    21        PRE_INC                                                  !3
         22    >   IS_SMALLER                                               !3, !1
         23      > JMPNZ                                                    ~17, ->13
   15    24    >   INIT_FCALL                                               'printf'
         25        SEND_VAL                                                 'array_reverse%3A+%25fs%0A'
         26        INIT_FCALL                                               'microtime'
         27        SEND_VAL                                                 <true>
         28        DO_ICALL                                         $18     
         29        SUB                                              ~19     $18, !2
         30        SEND_VAL                                                 ~19
         31        DO_ICALL                                                 
   17    32        INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $21     
         35        ASSIGN                                                   !2, $21
   18    36        ASSIGN                                                   !3, 0
         37      > JMP                                                      ->52
   19    38    >   INIT_FCALL                                               'array_values'
         39        SEND_VAR                                                 !0
         40        DO_ICALL                                         $24     
         41        ASSIGN                                                   !4, $24
   20    42        COUNT                                            ~26     !4
         43        SUB                                              ~27     ~26, 1
         44        ASSIGN                                                   !6, ~27
         45      > JMP                                                      ->49
   21    46    >   FETCH_DIM_R                                      ~29     !4, !6
         47        ASSIGN                                                   !5, ~29
   20    48        PRE_DEC                                                  !6
         49    >   IS_SMALLER_OR_EQUAL                                      0, !6
         50      > JMPNZ                                                    ~32, ->46
   18    51    >   PRE_INC                                                  !3
         52    >   IS_SMALLER                                               !3, !1
         53      > JMPNZ                                                    ~34, ->38
   24    54    >   INIT_FCALL                                               'printf'
         55        SEND_VAL                                                 'array_values+%25fs%0A'
         56        INIT_FCALL                                               'microtime'
         57        SEND_VAL                                                 <true>
         58        DO_ICALL                                         $35     
         59        SUB                                              ~36     $35, !2
         60        SEND_VAL                                                 ~36
         61        DO_ICALL                                                 
   26    62        INIT_FCALL                                               'microtime'
         63        SEND_VAL                                                 <true>
         64        DO_ICALL                                         $38     
         65        ASSIGN                                                   !2, $38
   27    66        ASSIGN                                                   !3, 0
         67      > JMP                                                      ->76
   28    68    >   ASSIGN                                                   !4, !0
   29    69      > JMP                                                      ->74
   30    70    >   INIT_FCALL                                               'array_pop'
         71        SEND_REF                                                 !4
         72        DO_ICALL                                         $42     
         73        ASSIGN                                                   !5, $42
   29    74    > > JMPNZ                                                    !4, ->70
   27    75    >   PRE_INC                                                  !3
         76    >   IS_SMALLER                                               !3, !1
         77      > JMPNZ                                                    ~45, ->68
   33    78    >   INIT_FCALL                                               'printf'
         79        SEND_VAL                                                 'array_pop%3A+%25fs%0A'
         80        INIT_FCALL                                               'microtime'
         81        SEND_VAL                                                 <true>
         82        DO_ICALL                                         $46     
         83        SUB                                              ~47     $46, !2
         84        SEND_VAL                                                 ~47
         85        DO_ICALL                                                 
         86      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.08 ms | 1404 KiB | 25 Q