3v4l.org

run code in 300+ PHP versions simultaneously
<?php function detectGender($keyword) { $gender = 0; $genderKeywords = [ 'MY' => [ 1 => 'men,male', 2 => 'women,female', ], 'SG' => [ 1 => 'men,male', 2 => 'women,female', ], 'HK' => [ 1 => 'men,male', 2 => 'women,female', ], 'PH' => [ 1 => 'men,male', 2 => 'women,female', ], 'TH' => [ 1 => 'ชาย,ผชาย', 2 => 'หญง,ผหญง', ], 'VN' => [ 1 => 'nam', 2 => 'nu', ], 'ID' => [ 1 => 'pria', 2 => 'wanita', ], ]; foreach ($genderKeywords['VN'] as $key => $keywords) { if (array_search($keyword, explode(',', $keywords)) !== false) { return $key; } } return $gender; } 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/okDoD
function name:  (null)
number of ops:  12
compiled vars:  !0 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   ASSIGN                                                   !0, 0
          1      > JMP                                                      ->9
   45     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                                                 
   44     8        PRE_INC                                                  !0
          9    >   IS_SMALLER                                               !0, 20000
         10      > JMPNZ                                                    ~5, ->2
   46    11    > > RETURN                                                   1

Function detectgender:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 20
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 19
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/okDoD
function name:  detectGender
number of ops:  23
compiled vars:  !0 = $keyword, !1 = $gender, !2 = $genderKeywords, !3 = $keywords, !4 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, 0
    6     2        ASSIGN                                                   !2, <array>
   36     3        FETCH_DIM_R                                      ~7      !2, 'VN'
          4      > FE_RESET_R                                       $8      ~7, ->20
          5    > > FE_FETCH_R                                       ~9      $8, !3, ->20
          6    >   ASSIGN                                                   !4, ~9
   37     7        INIT_FCALL                                               'array_search'
          8        SEND_VAR                                                 !0
          9        INIT_FCALL                                               'explode'
         10        SEND_VAL                                                 '%2C'
         11        SEND_VAR                                                 !3
         12        DO_ICALL                                         $11     
         13        SEND_VAR                                                 $11
         14        DO_ICALL                                         $12     
         15        TYPE_CHECK                                  1018          $12
         16      > JMPZ                                                     ~13, ->19
   38    17    >   FE_FREE                                                  $8
         18      > RETURN                                                   !4
   36    19    > > JMP                                                      ->5
         20    >   FE_FREE                                                  $8
   41    21      > RETURN                                                   !1
   42    22*     > RETURN                                                   null

End of function detectgender

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
200.05 ms | 1402 KiB | 20 Q