3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); /** * @param array{a?:array{b:bool}} $options */ function f(array $options): bool { if (isset($options['a']['b'])) { return true; } return false; } /** * @param array{a?:array{b:bool}} $options */ function g(array $options): bool { if (isset($options['a'], $options['a']['b'])) { return true; } return false; } var_dump(f([]));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fjfml
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'f'
          2        SEND_VAL                                                 <array>
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fjfml
function name:  f
number of ops:  8
compiled vars:  !0 = $options
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        FETCH_DIM_IS                                     ~1      !0, 'a'
          2        ISSET_ISEMPTY_DIM_OBJ                         0          ~1, 'b'
          3      > JMPZ                                                     ~2, ->5
    9     4    > > RETURN                                                   <true>
   12     5    > > RETURN                                                   <false>
   13     6*       VERIFY_RETURN_TYPE                                       
          7*     > RETURN                                                   null

End of function f

Function g:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 8
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/fjfml
function name:  g
number of ops:  11
compiled vars:  !0 = $options
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        ISSET_ISEMPTY_DIM_OBJ                         0  ~1      !0, 'a'
          2      > JMPZ_EX                                          ~1      ~1, ->6
          3    >   FETCH_DIM_IS                                     ~2      !0, 'a'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~3      ~2, 'b'
          5        BOOL                                             ~1      ~3
          6    > > JMPZ                                                     ~1, ->8
   22     7    > > RETURN                                                   <true>
   25     8    > > RETURN                                                   <false>
   26     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function g

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.1 ms | 1019 KiB | 15 Q