3v4l.org

run code in 500+ 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 number_format($total_time, 6) . ' Total time - isset' , PHP_EOL; $start = microtime( true ); for ($i = 0; $i < 10000; ++$i) { in_array(rand(1, 1000000), $a); } $total_time = microtime( true ) - $start; echo number_format($total_time, 6) . ' Total time - in_array' , 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 = 57
Branch analysis from position: 57
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 50
Branch analysis from position: 59
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
2 jumps found. (Code = 44) Position 1 = 59, Position 2 = 50
Branch analysis from position: 59
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/0D3MS
function name:  (null)
number of ops:  72
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        INIT_FCALL                                                   'number_format'
         38        SEND_VAR                                                     !4
         39        SEND_VAL                                                     6
         40        DO_ICALL                                             $23     
         41        CONCAT                                               ~24     $23, '+Total+time+-+isset'
         42        ECHO                                                         ~24
         43        ECHO                                                         '%0A'
   18    44        INIT_FCALL                                                   'microtime'
         45        SEND_VAL                                                     <true>
         46        DO_ICALL                                             $25     
         47        ASSIGN                                                       !3, $25
   20    48        ASSIGN                                                       !1, 0
         49      > JMP                                                          ->57
   21    50    >   INIT_FCALL                                                   'rand'
         51        SEND_VAL                                                     1
         52        SEND_VAL                                                     1000000
         53        DO_ICALL                                             $28     
         54        FRAMELESS_ICALL_2                in_array            ~29     $28, !0
         55        FREE                                                         ~29
   20    56        PRE_INC                                                      !1
         57    >   IS_SMALLER                                                   !1, 10000
         58      > JMPNZ                                                        ~31, ->50
   24    59    >   INIT_FCALL                                                   'microtime'
         60        SEND_VAL                                                     <true>
         61        DO_ICALL                                             $32     
         62        SUB                                                  ~33     $32, !3
         63        ASSIGN                                                       !4, ~33
   25    64        INIT_FCALL                                                   'number_format'
         65        SEND_VAR                                                     !4
         66        SEND_VAL                                                     6
         67        DO_ICALL                                             $35     
         68        CONCAT                                               ~36     $35, '+Total+time+-+in_array'
         69        ECHO                                                         ~36
         70        ECHO                                                         '%0A'
   26    71      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
164.37 ms | 1370 KiB | 16 Q