3v4l.org

run code in 300+ PHP versions simultaneously
<?php $value = utf8_decode('Österreich'); $encoding = mb_detect_encoding($value); $country = $value; if ($encoding != 'ISO-8859-1') { $country = mb_convert_encoding($country, 'ISO-8859-1', $encoding); } $country = mb_strtolower($country, 'ISO-8859-1'); switch ($country) { case 'deutschland': case 'de': echo "de"; break; case 'österreich': case 'at': case 'oesterreich': echo "at"; break; default: throw new Exception('Invalid country: ' . $value); break; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
7 jumps found. (Code = 188) Position 1 = 34, Position 2 = 34, Position 3 = 36, Position 4 = 36, Position 5 = 36, Position 6 = 38, Position 7 = 23
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 44
Branch analysis from position: 44
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 38
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 34
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 34
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 36
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 36
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 36
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 36
Branch analysis from position: 34
Branch analysis from position: 34
Branch analysis from position: 17
filename:       /in/FhZRm
function name:  (null)
number of ops:  45
compiled vars:  !0 = $value, !1 = $encoding, !2 = $country
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'utf8_decode'
          1        SEND_VAL                                                 '%C3%96sterreich'
          2        DO_ICALL                                         $3      
          3        ASSIGN                                                   !0, $3
    3     4        INIT_FCALL                                               'mb_detect_encoding'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !1, $5
    4     8        ASSIGN                                                   !2, !0
    5     9        IS_NOT_EQUAL                                             !1, 'ISO-8859-1'
         10      > JMPZ                                                     ~8, ->17
    6    11    >   INIT_FCALL                                               'mb_convert_encoding'
         12        SEND_VAR                                                 !2
         13        SEND_VAL                                                 'ISO-8859-1'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $9      
         16        ASSIGN                                                   !2, $9
    9    17    >   INIT_FCALL                                               'mb_strtolower'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 'ISO-8859-1'
         20        DO_ICALL                                         $11     
         21        ASSIGN                                                   !2, $11
   11    22      > SWITCH_STRING                                            !2, [ 'deutschland':->34, 'de':->34, '%C3%B6sterreich':->36, 'at':->36, 'oesterreich':->36, ], ->38
   12    23    >   IS_EQUAL                                                 !2, 'deutschland'
         24      > JMPNZ                                                    ~13, ->34
   13    25    >   IS_EQUAL                                                 !2, 'de'
         26      > JMPNZ                                                    ~13, ->34
   17    27    >   IS_EQUAL                                                 !2, '%C3%B6sterreich'
         28      > JMPNZ                                                    ~13, ->36
   18    29    >   IS_EQUAL                                                 !2, 'at'
         30      > JMPNZ                                                    ~13, ->36
   19    31    >   IS_EQUAL                                                 !2, 'oesterreich'
         32      > JMPNZ                                                    ~13, ->36
         33    > > JMP                                                      ->38
   14    34    >   ECHO                                                     'de'
   15    35      > JMP                                                      ->44
   20    36    >   ECHO                                                     'at'
   21    37      > JMP                                                      ->44
   24    38    >   NEW                                              $14     'Exception'
         39        CONCAT                                           ~15     'Invalid+country%3A+', !0
         40        SEND_VAL_EX                                              ~15
         41        DO_FCALL                                      0          
         42      > THROW                                         0          $14
   25    43*       JMP                                                      ->44
   26    44    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.86 ms | 1400 KiB | 21 Q