3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "Ovo je samo jedan od testnih kodova"; $a = array('a','e','i','o','u'); $strlen = strlen( $str ); $siz = sizeof($a); $res = ""; $rest = ""; $t= ""; $sugl = array(); $pozsugl = array(); for( $i = 0; $i <= $strlen; $i++ ) { $char = substr( $str, $i, 1 ); $t = false; // $char contains the current character, so do your processing here for($j=0; $j<$siz;$j++) { if($a[$j] === $char) { $t = true; if($j+1 === $siz) { $res.= $a[0]; break; } else { $res .= $a[$j+1]; break; } } } if(!$t) { $res.=$char; array_push($sugl, $char); array_push($pozsugl, $i); } } echo "\n"."sugl ".printing($sugl)."\n" ; echo "\n"."pozsugl ".printing($pozsugl)."\n"; $sugl = sorty($sugl); echo "\n"."sugl poslije sorty ".printing($sugl)."\n"; echo "\n"."\n"."Rezultat prije ". $res ."\n"; echo "\n"."Rezultat nakon svega:" . changeChar($res,$pozsugl, $sugl); function sorty($c) { $siz = sizeof($c); $tmp = $c[0]; for ($i = 1; $i < $siz; $i++) $c[$i - 1] = $c[$i]; $c[$siz - 1] = $tmp; return $c; } function changeChar($str, $pozsugl, $sugl) { $strlen = strlen( $str ); $siz= sizeof($pozsugl); $rez = ""; for($i = 0; $i <= $strlen; $i++) { $char = substr( $str, $i, 1 ); for($j=0; $j<$siz;$j++) { if($i === $pozsugl[$j]) { $char=$sugl[$j]; break; } } $rez.=$char; } return $rez; } function printing($f) { $siz= sizeof($f); $t=""; for($k=0; $k <$siz; $k++) $t.=$f[$k]; echo $t; } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 52
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 13
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 22
Branch analysis from position: 40
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 51
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 54, Position 2 = 13
Branch analysis from position: 54
Branch analysis from position: 13
Branch analysis from position: 51
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 37
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 33
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 40, Position 2 = 22
Branch analysis from position: 40
Branch analysis from position: 22
filename:       /in/FQWFi
function name:  (null)
number of ops:  87
compiled vars:  !0 = $str, !1 = $a, !2 = $strlen, !3 = $siz, !4 = $res, !5 = $rest, !6 = $t, !7 = $sugl, !8 = $pozsugl, !9 = $i, !10 = $char, !11 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Ovo+je+samo+jedan+od+testnih+kodova'
    3     1        ASSIGN                                                   !1, <array>
    4     2        STRLEN                                           ~14     !0
          3        ASSIGN                                                   !2, ~14
    5     4        COUNT                                            ~16     !1
          5        ASSIGN                                                   !3, ~16
    6     6        ASSIGN                                                   !4, ''
    7     7        ASSIGN                                                   !5, ''
    8     8        ASSIGN                                                   !6, ''
    9     9        ASSIGN                                                   !7, <array>
   10    10        ASSIGN                                                   !8, <array>
   11    11        ASSIGN                                                   !9, 0
         12      > JMP                                                      ->52
   12    13    >   INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !9
         16        SEND_VAL                                                 1
         17        DO_ICALL                                         $24     
         18        ASSIGN                                                   !10, $24
   13    19        ASSIGN                                                   !6, <false>
   15    20        ASSIGN                                                   !11, 0
         21      > JMP                                                      ->38
   16    22    >   FETCH_DIM_R                                      ~28     !1, !11
         23        IS_IDENTICAL                                             !10, ~28
         24      > JMPZ                                                     ~29, ->37
   17    25    >   ASSIGN                                                   !6, <true>
   18    26        ADD                                              ~31     !11, 1
         27        IS_IDENTICAL                                             !3, ~31
         28      > JMPZ                                                     ~32, ->33
   19    29    >   FETCH_DIM_R                                      ~33     !1, 0
         30        ASSIGN_OP                                     8          !4, ~33
   20    31      > JMP                                                      ->40
         32*       JMP                                                      ->37
   23    33    >   ADD                                              ~35     !11, 1
         34        FETCH_DIM_R                                      ~36     !1, ~35
         35        ASSIGN_OP                                     8          !4, ~36
   24    36      > JMP                                                      ->40
   15    37    >   PRE_INC                                                  !11
         38    >   IS_SMALLER                                               !11, !3
         39      > JMPNZ                                                    ~39, ->22
   28    40    >   BOOL_NOT                                         ~40     !6
         41      > JMPZ                                                     ~40, ->51
   29    42    >   ASSIGN_OP                                     8          !4, !10
   30    43        INIT_FCALL                                               'array_push'
         44        SEND_REF                                                 !7
         45        SEND_VAR                                                 !10
         46        DO_ICALL                                                 
   31    47        INIT_FCALL                                               'array_push'
         48        SEND_REF                                                 !8
         49        SEND_VAR                                                 !9
         50        DO_ICALL                                                 
   11    51    >   PRE_INC                                                  !9
         52    >   IS_SMALLER_OR_EQUAL                                      !9, !2
         53      > JMPNZ                                                    ~45, ->13
   34    54    >   INIT_FCALL_BY_NAME                                       'printing'
         55        SEND_VAR_EX                                              !7
         56        DO_FCALL                                      0  $46     
         57        CONCAT                                           ~47     '%0Asugl+', $46
         58        CONCAT                                           ~48     ~47, '%0A'
         59        ECHO                                                     ~48
   35    60        INIT_FCALL_BY_NAME                                       'printing'
         61        SEND_VAR_EX                                              !8
         62        DO_FCALL                                      0  $49     
         63        CONCAT                                           ~50     '%0Apozsugl+', $49
         64        CONCAT                                           ~51     ~50, '%0A'
         65        ECHO                                                     ~51
   36    66        INIT_FCALL_BY_NAME                                       'sorty'
         67        SEND_VAR_EX                                              !7
         68        DO_FCALL                                      0  $52     
         69        ASSIGN                                                   !7, $52
   37    70        INIT_FCALL_BY_NAME                                       'printing'
         71        SEND_VAR_EX                                              !7
         72        DO_FCALL                                      0  $54     
         73        CONCAT                                           ~55     '%0Asugl+poslije+sorty+', $54
         74        CONCAT                                           ~56     ~55, '%0A'
         75        ECHO                                                     ~56
   38    76        CONCAT                                           ~57     '%0A%0ARezultat+prije+', !4
         77        CONCAT                                           ~58     ~57, '%0A'
         78        ECHO                                                     ~58
   39    79        INIT_FCALL_BY_NAME                                       'changeChar'
         80        SEND_VAR_EX                                              !4
         81        SEND_VAR_EX                                              !8
         82        SEND_VAR_EX                                              !7
         83        DO_FCALL                                      0  $59     
         84        CONCAT                                           ~60     '%0ARezultat+nakon+svega%3A', $59
         85        ECHO                                                     ~60
   77    86      > RETURN                                                   1

Function sorty:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 14, Position 2 = 7
Branch analysis from position: 14
Branch analysis from position: 7
filename:       /in/FQWFi
function name:  sorty
number of ops:  19
compiled vars:  !0 = $c, !1 = $siz, !2 = $tmp, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   RECV                                             !0      
   43     1        COUNT                                            ~4      !0
          2        ASSIGN                                                   !1, ~4
   44     3        FETCH_DIM_R                                      ~6      !0, 0
          4        ASSIGN                                                   !2, ~6
   45     5        ASSIGN                                                   !3, 1
          6      > JMP                                                      ->12
   46     7    >   SUB                                              ~9      !3, 1
          8        FETCH_DIM_R                                      ~11     !0, !3
          9        ASSIGN_DIM                                               !0, ~9
         10        OP_DATA                                                  ~11
   45    11        PRE_INC                                                  !3
         12    >   IS_SMALLER                                               !3, !1
         13      > JMPNZ                                                    ~13, ->7
   47    14    >   SUB                                              ~14     !1, 1
         15        ASSIGN_DIM                                               !0, ~14
         16        OP_DATA                                                  !2
   48    17      > RETURN                                                   !0
   49    18*     > RETURN                                                   null

End of function sorty

Function changechar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 10
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 18
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 31, Position 2 = 10
Branch analysis from position: 31
Branch analysis from position: 10
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 24
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 27, Position 2 = 18
Branch analysis from position: 27
Branch analysis from position: 18
filename:       /in/FQWFi
function name:  changeChar
number of ops:  33
compiled vars:  !0 = $str, !1 = $pozsugl, !2 = $sugl, !3 = $strlen, !4 = $siz, !5 = $rez, !6 = $i, !7 = $char, !8 = $j
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   50     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   51     3        STRLEN                                           ~9      !0
          4        ASSIGN                                                   !3, ~9
   52     5        COUNT                                            ~11     !1
          6        ASSIGN                                                   !4, ~11
   53     7        ASSIGN                                                   !5, ''
   54     8        ASSIGN                                                   !6, 0
          9      > JMP                                                      ->29
   55    10    >   INIT_FCALL                                               'substr'
         11        SEND_VAR                                                 !0
         12        SEND_VAR                                                 !6
         13        SEND_VAL                                                 1
         14        DO_ICALL                                         $15     
         15        ASSIGN                                                   !7, $15
   56    16        ASSIGN                                                   !8, 0
         17      > JMP                                                      ->25
   57    18    >   FETCH_DIM_R                                      ~18     !1, !8
         19        IS_IDENTICAL                                             !6, ~18
         20      > JMPZ                                                     ~19, ->24
   58    21    >   FETCH_DIM_R                                      ~20     !2, !8
         22        ASSIGN                                                   !7, ~20
   59    23      > JMP                                                      ->27
   56    24    >   PRE_INC                                                  !8
         25    >   IS_SMALLER                                               !8, !4
         26      > JMPNZ                                                    ~23, ->18
   62    27    >   ASSIGN_OP                                     8          !5, !7
   54    28        PRE_INC                                                  !6
         29    >   IS_SMALLER_OR_EQUAL                                      !6, !3
         30      > JMPNZ                                                    ~26, ->10
   64    31    > > RETURN                                                   !5
   65    32*     > RETURN                                                   null

End of function changechar

Function printing:
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 = 6
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 11, Position 2 = 6
Branch analysis from position: 11
Branch analysis from position: 6
filename:       /in/FQWFi
function name:  printing
number of ops:  13
compiled vars:  !0 = $f, !1 = $siz, !2 = $t, !3 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   67     0  E >   RECV                                             !0      
   68     1        COUNT                                            ~4      !0
          2        ASSIGN                                                   !1, ~4
   69     3        ASSIGN                                                   !2, ''
   70     4        ASSIGN                                                   !3, 0
          5      > JMP                                                      ->9
   71     6    >   FETCH_DIM_R                                      ~8      !0, !3
          7        ASSIGN_OP                                     8          !2, ~8
   70     8        PRE_INC                                                  !3
          9    >   IS_SMALLER                                               !3, !1
         10      > JMPNZ                                                    ~11, ->6
   72    11    >   ECHO                                                     !2
   74    12      > RETURN                                                   null

End of function printing

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
178.64 ms | 1412 KiB | 17 Q