3v4l.org

run code in 300+ PHP versions simultaneously
<?php $translations = ["testkey" => ["de" => "TESTKEYDEUTSCH", "en" => "TESTKEYENGLISH"], "testkey2" => ["de" => "TESTKEYDEUTSCH", "en" => "TESTKEYENGLISH"], ]; function stringByLanguage($key, $lang) { var_dump($translations); if(array_key_exists($key, $translations)){ var_dump(array_key_exists($key, $translations["key"])); if(isset($translations[$key][$lang])){ return $translations[$key][$lang]; } elseif (isset($translations[$key]["de"])) { return $translations[$key]["de"]; } } return "missing key ".$key."_".$lang; } echo stringByLanguage("testkey2","fr");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rWDZU
function name:  (null)
number of ops:  7
compiled vars:  !0 = $translations
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        INIT_FCALL                                               'stringbylanguage'
          2        SEND_VAL                                                 'testkey2'
          3        SEND_VAL                                                 'fr'
          4        DO_FCALL                                      0  $2      
          5        ECHO                                                     $2
          6      > RETURN                                                   1

Function stringbylanguage:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 25
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 19
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 25
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/rWDZU
function name:  stringByLanguage
number of ops:  30
compiled vars:  !0 = $key, !1 = $lang, !2 = $translations
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !2
          4        DO_ICALL                                                 
   11     5        ARRAY_KEY_EXISTS                                         !0, !2
          6      > JMPZ                                                     ~4, ->25
   12     7    >   INIT_FCALL                                               'var_dump'
          8        FETCH_DIM_R                                      ~5      !2, 'key'
          9        ARRAY_KEY_EXISTS                                 ~6      !0, ~5
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                                 
   13    12        FETCH_DIM_IS                                     ~8      !2, !0
         13        ISSET_ISEMPTY_DIM_OBJ                         0          ~8, !1
         14      > JMPZ                                                     ~9, ->19
   14    15    >   FETCH_DIM_R                                      ~10     !2, !0
         16        FETCH_DIM_R                                      ~11     ~10, !1
         17      > RETURN                                                   ~11
         18*       JMP                                                      ->25
   15    19    >   FETCH_DIM_IS                                     ~12     !2, !0
         20        ISSET_ISEMPTY_DIM_OBJ                         0          ~12, 'de'
         21      > JMPZ                                                     ~13, ->25
   16    22    >   FETCH_DIM_R                                      ~14     !2, !0
         23        FETCH_DIM_R                                      ~15     ~14, 'de'
         24      > RETURN                                                   ~15
   19    25    >   CONCAT                                           ~16     'missing+key+', !0
         26        CONCAT                                           ~17     ~16, '_'
         27        CONCAT                                           ~18     ~17, !1
         28      > RETURN                                                   ~18
   20    29*     > RETURN                                                   null

End of function stringbylanguage

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.96 ms | 1394 KiB | 16 Q