3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(); for ($i = 0; $i < 10000; ++$i) { $v = rand(1, 1000000); $a[$v] = $v; } echo "Size: ", count($a), PHP_EOL; $start = microtime( true ); for ($i = 0; $i < 10000; ++$i) { isset($a[rand(1, 1000000)]); } $total_time = microtime( true ) - $start; echo "Total time isset: ", number_format($total_time, 6), PHP_EOL; $start = microtime( true ); for ($i = 0; $i < 10000; ++$i) { in_array(rand(1, 1000000), $a); } $total_time = microtime( true ) - $start; echo "Total time in_array: ", number_format($total_time, 6), PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 23
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 59
Branch analysis from position: 59
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 50
Branch analysis from position: 61
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 61, Position 2 = 50
Branch analysis from position: 61
Branch analysis from position: 50
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 23
Branch analysis from position: 32
Branch analysis from position: 23
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 3
Branch analysis from position: 13
Branch analysis from position: 3
filename:       /in/mttn2
function name:  (null)
number of ops:  74
compiled vars:  !0 = $a, !1 = $i, !2 = $v, !3 = $start, !4 = $total_time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, 0
          2      > JMP                                                      ->11
    4     3    >   INIT_FCALL                                               'rand'
          4        SEND_VAL                                                 1
          5        SEND_VAL                                                 1000000
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
    5     8        ASSIGN_DIM                                               !0, !2
          9        OP_DATA                                                  !2
    3    10        PRE_INC                                                  !1
         11    >   IS_SMALLER                                               !1, 10000
         12      > JMPNZ                                                    ~11, ->3
    7    13    >   ECHO                                                     'Size%3A+'
         14        COUNT                                            ~12     !0
         15        ECHO                                                     ~12
         16        ECHO                                                     '%0A'
    9    17        INIT_FCALL                                               'microtime'
         18        SEND_VAL                                                 <true>
         19        DO_ICALL                                         $13     
         20        ASSIGN                                                   !3, $13
   11    21        ASSIGN                                                   !1, 0
         22      > JMP                                                      ->30
   12    23    >   INIT_FCALL                                               'rand'
         24        SEND_VAL                                                 1
         25        SEND_VAL                                                 1000000
         26        DO_ICALL                                         $16     
         27        ISSET_ISEMPTY_DIM_OBJ                         0  ~17     !0, $16
         28        FREE                                                     ~17
   11    29        PRE_INC                                                  !1
         30    >   IS_SMALLER                                               !1, 10000
         31      > JMPNZ                                                    ~19, ->23
   15    32    >   INIT_FCALL                                               'microtime'
         33        SEND_VAL                                                 <true>
         34        DO_ICALL                                         $20     
         35        SUB                                              ~21     $20, !3
         36        ASSIGN                                                   !4, ~21
   16    37        ECHO                                                     'Total+time+isset%3A+'
         38        INIT_FCALL                                               'number_format'
         39        SEND_VAR                                                 !4
         40        SEND_VAL                                                 6
         41        DO_ICALL                                         $23     
         42        ECHO                                                     $23
         43        ECHO                                                     '%0A'
   18    44        INIT_FCALL                                               'microtime'
         45        SEND_VAL                                                 <true>
         46        DO_ICALL                                         $24     
         47        ASSIGN                                                   !3, $24
   20    48        ASSIGN                                                   !1, 0
         49      > JMP                                                      ->59
   21    50    >   INIT_FCALL                                               'in_array'
         51        INIT_FCALL                                               'rand'
         52        SEND_VAL                                                 1
         53        SEND_VAL                                                 1000000
         54        DO_ICALL                                         $27     
         55        SEND_VAR                                                 $27
         56        SEND_VAR                                                 !0
         57        DO_ICALL                                                 
   20    58        PRE_INC                                                  !1
         59    >   IS_SMALLER                                               !1, 10000
         60      > JMPNZ                                                    ~30, ->50
   24    61    >   INIT_FCALL                                               'microtime'
         62        SEND_VAL                                                 <true>
         63        DO_ICALL                                         $31     
         64        SUB                                              ~32     $31, !3
         65        ASSIGN                                                   !4, ~32
   25    66        ECHO                                                     'Total+time+in_array%3A+'
         67        INIT_FCALL                                               'number_format'
         68        SEND_VAR                                                 !4
         69        SEND_VAL                                                 6
         70        DO_ICALL                                         $34     
         71        ECHO                                                     $34
         72        ECHO                                                     '%0A'
         73      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.45 ms | 1400 KiB | 21 Q