3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "\n"; class ArrayUtils { public static function isAssoc1(array $array) { self::completeArguments1($array); return $array['c']; } public static function isAssoc2(array $array) { $array = self::completeArguments2($array); return $array['c']; } public static function completeArguments1(array &$arguments) { if (!isset($arguments['c'])) { $arguments['c'] = 3; } } public static function completeArguments2(array $arguments) { if (!isset($arguments['c'])) { $arguments['c'] = 3; } return $arguments; } } $a1 = ['a' => 1, 'b' => 2, 'd' => 4]; $a2 = ['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4]; $size = 100000; for ($i = 0; $i < $size; $i++) { ArrayUtils::isAssoc1($a2); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
Branch analysis from position: 6
filename:       /in/i5OfG
function name:  (null)
number of ops:  13
compiled vars:  !0 = $a1, !1 = $a2, !2 = $size, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     '%0A'
   38     1        ASSIGN                                                   !0, <array>
   39     2        ASSIGN                                                   !1, <array>
   40     3        ASSIGN                                                   !2, 100000
   43     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->10
   44     6    >   INIT_STATIC_METHOD_CALL                                  'ArrayUtils', 'isAssoc1'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0          
   43     9        PRE_INC                                                  !3
         10    >   IS_SMALLER                                               !3, !2
         11      > JMPNZ                                                    ~10, ->6
   45    12    > > RETURN                                                   1

Class ArrayUtils:
Function isassoc1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i5OfG
function name:  isAssoc1
number of ops:  7
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_STATIC_METHOD_CALL                                  'completeArguments1'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
   11     4        FETCH_DIM_R                                      ~2      !0, 'c'
          5      > RETURN                                                   ~2
   12     6*     > RETURN                                                   null

End of function isassoc1

Function isassoc2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/i5OfG
function name:  isAssoc2
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        INIT_STATIC_METHOD_CALL                                  'completeArguments2'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4        ASSIGN                                                   !0, $1
   18     5        FETCH_DIM_R                                      ~3      !0, 'c'
          6      > RETURN                                                   ~3
   19     7*     > RETURN                                                   null

End of function isassoc2

Function completearguments1:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/i5OfG
function name:  completeArguments1
number of ops:  7
compiled vars:  !0 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   23     1        ISSET_ISEMPTY_DIM_OBJ                         0  ~1      !0, 'c'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->6
   24     4    >   ASSIGN_DIM                                               !0, 'c'
          5        OP_DATA                                                  3
   26     6    > > RETURN                                                   null

End of function completearguments1

Function completearguments2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/i5OfG
function name:  completeArguments2
number of ops:  8
compiled vars:  !0 = $arguments
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   30     1        ISSET_ISEMPTY_DIM_OBJ                         0  ~1      !0, 'c'
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->6
   31     4    >   ASSIGN_DIM                                               !0, 'c'
          5        OP_DATA                                                  3
   34     6    > > RETURN                                                   !0
   35     7*     > RETURN                                                   null

End of function completearguments2

End of class ArrayUtils.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.9 ms | 1403 KiB | 13 Q