3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_ENV = [ 'ZASIS_UI_BACKGROUNDCOLOR' => '#FFF1EC', 'ZASIS_UI_INFOPANEL_ENABLE' => '1', 'ZASIS_UI_INFOPANEL_TEXT' => 'DEBUG IS ON', 'ZASIS_UI_INFOPANEL_BACKGROUNDCOLOR' => '#F44', ]; $arr = [ 'ui' => [ 'backgroundColor' => 'ZASIS_UI_BACKGROUNDCOLOR', 'infoPanel' => [ 'enable' => 'ZASIS_UI_INFOPANEL_ENABLE', 'text' => 'ZASIS_UI_INFOPANEL_TEXT', 'fontColor' => 'ZASIS_UI_INFOPANEL_FONTCOLOR', 'backgroundColor' => 'ZASIS_UI_INFOPANEL_BACKGROUNDCOLOR', ] ] ]; function loadEnv(&$data): void { if (is_array($data)) { foreach ($data as $key => &$value) { try { loadEnv($value); } catch (\InvalidArgumentException $e) { unset($data[$key]); } } } elseif (array_key_exists($data, $_ENV)) { $data = $_ENV[$data]; } else { throw new \InvalidArgumentException(); } } loadEnv($arr); print_r($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/aNejW
function name:  (null)
number of ops:  10
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_W                      global              $1      '_ENV'
          1        ASSIGN                                                   $1, <array>
   10     2        ASSIGN                                                   !0, <array>
   39     3        INIT_FCALL                                               'loadenv'
          4        SEND_REF                                                 !0
          5        DO_FCALL                                      0          
   40     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function loadenv:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 125) Position 1 = 4, Position 2 = 13
Branch analysis from position: 4
2 jumps found. (Code = 126) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
Branch analysis from position: 22
1 jumps found. (Code = 108) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
filename:       /in/aNejW
function name:  loadEnv
number of ops:  26
compiled vars:  !0 = $data, !1 = $value, !2 = $key, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~4, ->15
   25     3    > > FE_RESET_RW                                      $5      !0, ->13
          4    > > FE_FETCH_RW                                      ~6      $5, !1, ->13
          5    >   ASSIGN                                                   !2, ~6
   27     6        INIT_FCALL_BY_NAME                                       'loadEnv'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9      > JMP                                                      ->12
   28    10  E > > CATCH                                       last         'InvalidArgumentException'
   29    11    >   UNSET_DIM                                                !0, !2
   25    12    > > JMP                                                      ->4
         13    >   FE_FREE                                                  $5
   24    14      > JMP                                                      ->25
   32    15    >   FETCH_R                      global              ~9      '_ENV'
         16        ARRAY_KEY_EXISTS                                         !0, ~9
         17      > JMPZ                                                     ~10, ->22
   33    18    >   FETCH_R                      global              ~11     '_ENV'
         19        FETCH_DIM_R                                      ~12     ~11, !0
         20        ASSIGN                                                   !0, ~12
   32    21      > JMP                                                      ->25
   35    22    >   NEW                                              $14     'InvalidArgumentException'
         23        DO_FCALL                                      0          
         24      > THROW                                         0          $14
   37    25    > > RETURN                                                   null

End of function loadenv

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.89 ms | 1017 KiB | 15 Q