3v4l.org

run code in 300+ PHP versions simultaneously
<? function persian($word) { $prefix_list=array('na','bi','be','sər'); $prefix_count=count($prefix_list); $dictionary=array ( 'mərd'=>'man', 'kar'=>'work', 'çarə'=>'solution' ); for($index=0;$index<$prefix_count;$index++) //4 { $prefix=$prefix_list[$index]; $prefix_length=strlen($prefix); //2 2 2 3 $word_prefix=substr($word,0,$prefix_length); //namerd - na if($word_prefix==$prefix) { $root=substr($word,$prefix_length); //namerd, 2 2 2 3 return $root; } } } $word='namərd'; //$word='bekar'; //$word='biçarə'; //$word='sərbəst'; #1. koku 2. tercume persian($word); echo 'salam'; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e9H4G
function name:  (null)
number of ops:  6
compiled vars:  !0 = $word
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   ASSIGN                                                   !0, 'nam%C9%99rd'
   29     1        INIT_FCALL                                               'persian'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0          
   30     4        ECHO                                                     'salam'
   31     5      > RETURN                                                   1

Function persian:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 7
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 7
Branch analysis from position: 28
Branch analysis from position: 7
filename:       /in/e9H4G
function name:  persian
number of ops:  29
compiled vars:  !0 = $word, !1 = $prefix_list, !2 = $prefix_count, !3 = $dictionary, !4 = $index, !5 = $prefix, !6 = $prefix_length, !7 = $word_prefix, !8 = $root
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, <array>
    5     2        COUNT                                            ~10     !1
          3        ASSIGN                                                   !2, ~10
    6     4        ASSIGN                                                   !3, <array>
   12     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->26
   14     7    >   FETCH_DIM_R                                      ~14     !1, !4
          8        ASSIGN                                                   !5, ~14
   15     9        STRLEN                                           ~16     !5
         10        ASSIGN                                                   !6, ~16
   16    11        INIT_FCALL                                               'substr'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 0
         14        SEND_VAR                                                 !6
         15        DO_ICALL                                         $18     
         16        ASSIGN                                                   !7, $18
   17    17        IS_EQUAL                                                 !7, !5
         18      > JMPZ                                                     ~20, ->25
   19    19    >   INIT_FCALL                                               'substr'
         20        SEND_VAR                                                 !0
         21        SEND_VAR                                                 !6
         22        DO_ICALL                                         $21     
         23        ASSIGN                                                   !8, $21
   20    24      > RETURN                                                   !8
   12    25    >   PRE_INC                                                  !4
         26    >   IS_SMALLER                                               !4, !2
         27      > JMPNZ                                                    ~24, ->7
   23    28    > > RETURN                                                   null

End of function persian

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.89 ms | 1394 KiB | 16 Q