3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = [ 1 => ['Hello' => 'this is a nested hello!'], 'Hello' => 'this is a root hello!']; function getValue($root, $i = null) { $_t = isset($root[$i]) ? $root[$i] : $root; return isset($_t['Hello']) ? $_t['Hello'] : ''; } echo getValue($input); echo getValue($input, 1); echo getValue($input, 2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZKtQi
function name:  (null)
number of ops:  16
compiled vars:  !0 = $input
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        INIT_FCALL                                               'getvalue'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
   12     5        INIT_FCALL                                               'getvalue'
          6        SEND_VAR                                                 !0
          7        SEND_VAL                                                 1
          8        DO_FCALL                                      0  $3      
          9        ECHO                                                     $3
   13    10        INIT_FCALL                                               'getvalue'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 2
         13        DO_FCALL                                      0  $4      
         14        ECHO                                                     $4
         15      > RETURN                                                   1

Function getvalue:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
Branch analysis from position: 14
filename:       /in/ZKtQi
function name:  getValue
number of ops:  17
compiled vars:  !0 = $root, !1 = $i, !2 = $_t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    7     2        ISSET_ISEMPTY_DIM_OBJ                         0          !0, !1
          3      > JMPZ                                                     ~3, ->7
          4    >   FETCH_DIM_R                                      ~4      !0, !1
          5        QM_ASSIGN                                        ~5      ~4
          6      > JMP                                                      ->8
          7    >   QM_ASSIGN                                        ~5      !0
          8    >   ASSIGN                                                   !2, ~5
    8     9        ISSET_ISEMPTY_DIM_OBJ                         0          !2, 'Hello'
         10      > JMPZ                                                     ~7, ->14
         11    >   FETCH_DIM_R                                      ~8      !2, 'Hello'
         12        QM_ASSIGN                                        ~9      ~8
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~9      ''
         15    > > RETURN                                                   ~9
    9    16*     > RETURN                                                   null

End of function getvalue

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.98 ms | 1399 KiB | 16 Q