3v4l.org

run code in 500+ PHP versions simultaneously
<?php class NonExistant { protected $associativeArray = array( 'one' => 'one', 'two' => 'two', 'three' => 'three', 'four' => 'four', 'five' => 'five', 'six' => 'six', ); protected $numIterations = 1000; public function issetTest() { for ($i = 0; $i < $this->numIterations; $i++) { isset($this->associativeArray['none']); } } public function arrayKeyExistsTest() { for ($i = 0; $i < $this->numIterations; $i++) { array_key_exists('none', $this->associativeArray); } } } $class = new NonExistant(); foreach (array('issetTest', 'arrayKeyExistsTest') as $func) { $time_start = microtime(); $class->$func(); $time_end = microtime(); $time = $time_end - $time_start; echo "Did $func in $time seconds\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 22
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/hPpbU
function name:  (null)
number of ops:  24
compiled vars:  !0 = $class, !1 = $func, !2 = $time_start, !3 = $time_end, !4 = $time
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   30     0  E >   NEW                                                  $5      'NonExistant'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $5
   32     3      > FE_RESET_R                                           $8      <array>, ->22
          4    > > FE_FETCH_R                                                   $8, !1, ->22
   33     5    >   INIT_FCALL                                                   'microtime'
          6        DO_ICALL                                             $9      
          7        ASSIGN                                                       !2, $9
   34     8        INIT_METHOD_CALL                                             !0, !1
          9        DO_FCALL                                          0          
   35    10        INIT_FCALL                                                   'microtime'
         11        DO_ICALL                                             $12     
         12        ASSIGN                                                       !3, $12
   36    13        SUB                                                  ~14     !3, !2
         14        ASSIGN                                                       !4, ~14
   38    15        ROPE_INIT                                         5  ~17     'Did+'
         16        ROPE_ADD                                          1  ~17     ~17, !1
         17        ROPE_ADD                                          2  ~17     ~17, '+in+'
         18        ROPE_ADD                                          3  ~17     ~17, !4
         19        ROPE_END                                          4  ~16     ~17, '+seconds%0A'
         20        ECHO                                                         ~16
   32    21      > JMP                                                          ->4
         22    >   FE_FREE                                                      $8
   39    23      > RETURN                                                       1

Class NonExistant:
Function issettest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
Branch analysis from position: 2
filename:       /in/hPpbU
function name:  issetTest
number of ops:  10
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->6
   18     2    >   FETCH_OBJ_IS                                         ~2      'associativeArray'
          3        ISSET_ISEMPTY_DIM_OBJ                             0  ~3      ~2, 'none'
          4        FREE                                                         ~3
   17     5        PRE_INC                                                      !0
          6    >   FETCH_OBJ_R                                          ~5      'numIterations'
          7        IS_SMALLER                                                   !0, ~5
          8      > JMPNZ                                                        ~6, ->2
   20     9    > > RETURN                                                       null

End of function issettest

Function arraykeyexiststest:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 2
Branch analysis from position: 9
Branch analysis from position: 2
filename:       /in/hPpbU
function name:  arrayKeyExistsTest
number of ops:  10
compiled vars:  !0 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   ASSIGN                                                       !0, 0
          1      > JMP                                                          ->6
   25     2    >   FETCH_OBJ_R                                          ~2      'associativeArray'
          3        ARRAY_KEY_EXISTS                                     ~3      'none', ~2
          4        FREE                                                         ~3
   24     5        PRE_INC                                                      !0
          6    >   FETCH_OBJ_R                                          ~5      'numIterations'
          7        IS_SMALLER                                                   !0, ~5
          8      > JMPNZ                                                        ~6, ->2
   27     9    > > RETURN                                                       null

End of function arraykeyexiststest

End of class NonExistant.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.94 ms | 2468 KiB | 14 Q