3v4l.org

run code in 300+ PHP versions simultaneously
<?php function detectGender($keyword) { $defaultMapping = [ 'men' => 1, 'male' => 1, 'women' => 2, 'female' => 2 ]; $genderKeywords = [ 'MY' => $defaultMapping, 'SG' => $defaultMapping, 'HK' => $defaultMapping, 'PH' => $defaultMapping, 'TH' => [ 'ชาย' => 1, 'ผชาย' => 1, 'หญง' => 2, 'ผหญง' => 2, ], 'VN' => [ 'nam' => 1, 'nu' => 1, ], 'ID' => [ 'pria' => 1, 'wanita' => 1, ], ]; return isset($genderKeywords['VN'][$keyword]) ? $genderKeywords['VN'][$keyword] : 0; } for ($i = 0; $i < 20000; $i++) { print_r(detectGender('nam')); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 2
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 2
Branch analysis from position: 11
Branch analysis from position: 2
filename:       /in/Iavgv
function name:  (null)
number of ops:  12
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->9
   35     2    >   INIT_FCALL                                               'print_r'
          3        INIT_FCALL                                               'detectgender'
          4        SEND_VAL                                                 'nam'
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
   34     8        PRE_INC                                                  !0
          9    >   IS_SMALLER                                               !0, 20000
         10      > JMPNZ                                                    ~5, ->2
   36    11    > > RETURN                                                   1

Function detectgender:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 17
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Iavgv
function name:  detectGender
number of ops:  20
compiled vars:  !0 = $keyword, !1 = $defaultMapping, !2 = $genderKeywords
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        ASSIGN                                                   !1, <array>
   11     2        INIT_ARRAY                                       ~4      !1, 'MY'
   12     3        ADD_ARRAY_ELEMENT                                ~4      !1, 'SG'
   13     4        ADD_ARRAY_ELEMENT                                ~4      !1, 'HK'
   14     5        ADD_ARRAY_ELEMENT                                ~4      !1, 'PH'
   11     6        ADD_ARRAY_ELEMENT                                ~4      <array>, 'TH'
          7        ADD_ARRAY_ELEMENT                                ~4      <array>, 'VN'
          8        ADD_ARRAY_ELEMENT                                ~4      <array>, 'ID'
   10     9        ASSIGN                                                   !2, ~4
   31    10        FETCH_DIM_IS                                     ~6      !2, 'VN'
         11        ISSET_ISEMPTY_DIM_OBJ                         0          ~6, !0
         12      > JMPZ                                                     ~7, ->17
         13    >   FETCH_DIM_R                                      ~8      !2, 'VN'
         14        FETCH_DIM_R                                      ~9      ~8, !0
         15        QM_ASSIGN                                        ~10     ~9
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~10     0
         18    > > RETURN                                                   ~10
   32    19*     > RETURN                                                   null

End of function detectgender

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.43 ms | 1399 KiB | 16 Q