3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array(0 => true, 8 => true, 16 => true, 32 => true, 64 => true, 128 => true, 256 => true, 256 => 'foo'); $array = array('foo', true, true, true, true, true, true, 'foo'); ini_set('precision', 12); echo "Test with hash collisions\n"; for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); isset($arr[256]); $t = microtime(true) - $t; $r[] = $t; } array_pop($r); array_shift($r); printf("isset() test avg(10K): %.12f\n", array_sum($r) / count($r)); for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); in_array('foo', $arr); $t = microtime(true) - $t; $rr[] = $t; } array_pop($rr); array_shift($rr); printf("in_array() test avg(10K): %.12f \n", array_sum($rr) / count($rr)); echo "\n\nTests without hash collisions\n"; /* Without hash collisions */ for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); isset($array[7]); $t = microtime(true) - $t; $r[] = $t; } printf("isset() test avg(10K): %.12f\n", array_sum($r) / count($r)); for ($i = 0; $i <= 10000; $i++) { $t = microtime(true); in_array('foo', $array); $t = microtime(true) - $t; $rr[] = $t; } printf("in_array() test avg(10K): %.12f \n", array_sum($rr) / count($rr));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 9
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 58
Branch analysis from position: 58
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 42
Branch analysis from position: 60
1 jumps found. (Code = 42) Position 1 = 92
Branch analysis from position: 92
2 jumps found. (Code = 44) Position 1 = 94, Position 2 = 78
Branch analysis from position: 94
1 jumps found. (Code = 42) Position 1 = 121
Branch analysis from position: 121
2 jumps found. (Code = 44) Position 1 = 123, Position 2 = 105
Branch analysis from position: 123
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 105
2 jumps found. (Code = 44) Position 1 = 123, Position 2 = 105
Branch analysis from position: 123
Branch analysis from position: 105
Branch analysis from position: 78
2 jumps found. (Code = 44) Position 1 = 94, Position 2 = 78
Branch analysis from position: 94
Branch analysis from position: 78
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 60, Position 2 = 42
Branch analysis from position: 60
Branch analysis from position: 42
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 9
Branch analysis from position: 25
Branch analysis from position: 9
filename:       /in/B1loJ
function name:  (null)
number of ops:  133
compiled vars:  !0 = $arr, !1 = $array, !2 = $i, !3 = $t, !4 = $r, !5 = $rr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    5     2        INIT_FCALL                                               'ini_set'
          3        SEND_VAL                                                 'precision'
          4        SEND_VAL                                                 12
          5        DO_ICALL                                                 
    7     6        ECHO                                                     'Test+with+hash+collisions%0A'
    8     7        ASSIGN                                                   !2, 0
          8      > JMP                                                      ->23
    9     9    >   INIT_FCALL                                               'microtime'
         10        SEND_VAL                                                 <true>
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !3, $10
   10    13        ISSET_ISEMPTY_DIM_OBJ                         0  ~12     !0, 256
         14        FREE                                                     ~12
   11    15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $13     
         18        SUB                                              ~14     $13, !3
         19        ASSIGN                                                   !3, ~14
   12    20        ASSIGN_DIM                                               !4
         21        OP_DATA                                                  !3
    8    22        PRE_INC                                                  !2
         23    >   IS_SMALLER_OR_EQUAL                                      !2, 10000
         24      > JMPNZ                                                    ~18, ->9
   14    25    >   INIT_FCALL                                               'array_pop'
         26        SEND_REF                                                 !4
         27        DO_ICALL                                                 
   15    28        INIT_FCALL                                               'array_shift'
         29        SEND_REF                                                 !4
         30        DO_ICALL                                                 
   16    31        INIT_FCALL                                               'printf'
         32        SEND_VAL                                                 'isset%28%29+test+avg%2810K%29%3A+%25.12f%0A'
         33        INIT_FCALL                                               'array_sum'
         34        SEND_VAR                                                 !4
         35        DO_ICALL                                         $21     
         36        COUNT                                            ~22     !4
         37        DIV                                              ~23     $21, ~22
         38        SEND_VAL                                                 ~23
         39        DO_ICALL                                                 
   18    40        ASSIGN                                                   !2, 0
         41      > JMP                                                      ->58
   19    42    >   INIT_FCALL                                               'microtime'
         43        SEND_VAL                                                 <true>
         44        DO_ICALL                                         $26     
         45        ASSIGN                                                   !3, $26
   20    46        INIT_FCALL                                               'in_array'
         47        SEND_VAL                                                 'foo'
         48        SEND_VAR                                                 !0
         49        DO_ICALL                                                 
   21    50        INIT_FCALL                                               'microtime'
         51        SEND_VAL                                                 <true>
         52        DO_ICALL                                         $29     
         53        SUB                                              ~30     $29, !3
         54        ASSIGN                                                   !3, ~30
   22    55        ASSIGN_DIM                                               !5
         56        OP_DATA                                                  !3
   18    57        PRE_INC                                                  !2
         58    >   IS_SMALLER_OR_EQUAL                                      !2, 10000
         59      > JMPNZ                                                    ~34, ->42
   24    60    >   INIT_FCALL                                               'array_pop'
         61        SEND_REF                                                 !5
         62        DO_ICALL                                                 
   25    63        INIT_FCALL                                               'array_shift'
         64        SEND_REF                                                 !5
         65        DO_ICALL                                                 
   26    66        INIT_FCALL                                               'printf'
         67        SEND_VAL                                                 'in_array%28%29+test+avg%2810K%29%3A+%25.12f+%0A'
         68        INIT_FCALL                                               'array_sum'
         69        SEND_VAR                                                 !5
         70        DO_ICALL                                         $37     
         71        COUNT                                            ~38     !5
         72        DIV                                              ~39     $37, ~38
         73        SEND_VAL                                                 ~39
         74        DO_ICALL                                                 
   28    75        ECHO                                                     '%0A%0ATests+without+hash+collisions%0A'
   32    76        ASSIGN                                                   !2, 0
         77      > JMP                                                      ->92
   33    78    >   INIT_FCALL                                               'microtime'
         79        SEND_VAL                                                 <true>
         80        DO_ICALL                                         $42     
         81        ASSIGN                                                   !3, $42
   34    82        ISSET_ISEMPTY_DIM_OBJ                         0  ~44     !1, 7
         83        FREE                                                     ~44
   35    84        INIT_FCALL                                               'microtime'
         85        SEND_VAL                                                 <true>
         86        DO_ICALL                                         $45     
         87        SUB                                              ~46     $45, !3
         88        ASSIGN                                                   !3, ~46
   36    89        ASSIGN_DIM                                               !4
         90        OP_DATA                                                  !3
   32    91        PRE_INC                                                  !2
         92    >   IS_SMALLER_OR_EQUAL                                      !2, 10000
         93      > JMPNZ                                                    ~50, ->78
   38    94    >   INIT_FCALL                                               'printf'
         95        SEND_VAL                                                 'isset%28%29+test+avg%2810K%29%3A+%25.12f%0A'
         96        INIT_FCALL                                               'array_sum'
         97        SEND_VAR                                                 !4
         98        DO_ICALL                                         $51     
         99        COUNT                                            ~52     !4
        100        DIV                                              ~53     $51, ~52
        101        SEND_VAL                                                 ~53
        102        DO_ICALL                                                 
   40   103        ASSIGN                                                   !2, 0
        104      > JMP                                                      ->121
   41   105    >   INIT_FCALL                                               'microtime'
        106        SEND_VAL                                                 <true>
        107        DO_ICALL                                         $56     
        108        ASSIGN                                                   !3, $56
   42   109        INIT_FCALL                                               'in_array'
        110        SEND_VAL                                                 'foo'
        111        SEND_VAR                                                 !1
        112        DO_ICALL                                                 
   43   113        INIT_FCALL                                               'microtime'
        114        SEND_VAL                                                 <true>
        115        DO_ICALL                                         $59     
        116        SUB                                              ~60     $59, !3
        117        ASSIGN                                                   !3, ~60
   44   118        ASSIGN_DIM                                               !5
        119        OP_DATA                                                  !3
   40   120        PRE_INC                                                  !2
        121    >   IS_SMALLER_OR_EQUAL                                      !2, 10000
        122      > JMPNZ                                                    ~64, ->105
   46   123    >   INIT_FCALL                                               'printf'
        124        SEND_VAL                                                 'in_array%28%29+test+avg%2810K%29%3A+%25.12f+%0A'
        125        INIT_FCALL                                               'array_sum'
        126        SEND_VAR                                                 !5
        127        DO_ICALL                                         $65     
        128        COUNT                                            ~66     !5
        129        DIV                                              ~67     $65, ~66
        130        SEND_VAL                                                 ~67
        131        DO_ICALL                                                 
        132      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.55 ms | 1408 KiB | 27 Q