3v4l.org

run code in 500+ PHP versions simultaneously
<?php function make_ascii($str) { //return $str; $special = array('ľ','š','č','ť','ž','ý','á','í','é','ú','ä','ô','ň','ě'); $ascii = array('l','s','c','t','z','y','a','i','e','u','a','o','n','e'); $str = array_map(function ($i) use ($str) { return mb_substr($str, $i, 1); }, range(0, mb_strlen($str) -1)); //$str = preg_split("//u",$str); foreach ($str as $k => $c) { if( mb_strtoupper($c, "UTF-8") == $c) { $u = true; $c = mb_strtolower($c); } else { $u = false; } // print_r($c); if(in_array($c, $special)) { $c = $ascii[array_search($c, $special)]; } if($u) { $c = mb_strtoupper($c); } $str[$k] = $c; } return join($str); } $str = "ľÁľa ýellow"; var_dump(make_ascii($str));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bo1SF
function name:  (null)
number of ops:  8
compiled vars:  !0 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   29     0  E >   ASSIGN                                                       !0, '%C4%BE%C3%81%C4%BEa+%C3%BDellow'
   30     1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'make_ascii'
          3        SEND_VAR                                                     !0
          4        DO_FCALL                                          0  $2      
          5        SEND_VAR                                                     $2
          6        DO_ICALL                                                     
          7      > RETURN                                                       1

Function make_ascii:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 50
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 50
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 33
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
2 jumps found. (Code = 43) Position 1 = 43, Position 2 = 47
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 47
Branch analysis from position: 42
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 36, Position 2 = 42
Branch analysis from position: 36
Branch analysis from position: 42
Branch analysis from position: 50
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 50
filename:       /in/Bo1SF
function name:  make_ascii
number of ops:  56
compiled vars:  !0 = $str, !1 = $special, !2 = $ascii, !3 = $c, !4 = $k, !5 = $u
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
    5     1        ASSIGN                                                       !1, <array>
    6     2        ASSIGN                                                       !2, <array>
    7     3        INIT_FCALL                                                   'array_map'
          4        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
          5        BIND_LEXICAL                                                 ~8, !0
    9     6        SEND_VAL                                                     ~8
          7        INIT_FCALL                                                   'range'
          8        SEND_VAL                                                     0
          9        INIT_FCALL                                                   'mb_strlen'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                             $9      
         12        SUB                                                  ~10     $9, 1
         13        SEND_VAL                                                     ~10
         14        DO_ICALL                                             $11     
         15        SEND_VAR                                                     $11
    7    16        DO_ICALL                                             $12     
         17        ASSIGN                                                       !0, $12
   11    18      > FE_RESET_R                                           $14     !0, ->50
         19    > > FE_FETCH_R                                           ~15     $14, !3, ->50
         20    >   ASSIGN                                                       !4, ~15
   12    21        INIT_FCALL                                                   'mb_strtoupper'
         22        SEND_VAR                                                     !3
         23        SEND_VAL                                                     'UTF-8'
         24        DO_ICALL                                             $17     
         25        IS_EQUAL                                                     !3, $17
         26      > JMPZ                                                         ~18, ->33
   13    27    >   ASSIGN                                                       !5, <true>
   14    28        INIT_FCALL                                                   'mb_strtolower'
         29        SEND_VAR                                                     !3
         30        DO_ICALL                                             $20     
         31        ASSIGN                                                       !3, $20
   12    32      > JMP                                                          ->34
   16    33    >   ASSIGN                                                       !5, <false>
   19    34    >   FRAMELESS_ICALL_2                in_array            ~23     !3, !1
         35      > JMPZ                                                         ~23, ->42
   20    36    >   INIT_FCALL                                                   'array_search'
         37        SEND_VAR                                                     !3
         38        SEND_VAR                                                     !1
         39        DO_ICALL                                             $24     
         40        FETCH_DIM_R                                          ~25     !2, $24
         41        ASSIGN                                                       !3, ~25
   22    42    > > JMPZ                                                         !5, ->47
   23    43    >   INIT_FCALL                                                   'mb_strtoupper'
         44        SEND_VAR                                                     !3
         45        DO_ICALL                                             $27     
         46        ASSIGN                                                       !3, $27
   25    47    >   ASSIGN_DIM                                                   !0, !4
         48        OP_DATA                                                      !3
   11    49      > JMP                                                          ->19
         50    >   FE_FREE                                                      $14
   27    51        INIT_FCALL                                                   'join'
         52        SEND_VAR                                                     !0
         53        DO_ICALL                                             $30     
         54      > RETURN                                                       $30
   28    55*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Bo1SF
function name:  {closure:make_ascii():7}
number of ops:  9
compiled vars:  !0 = $i, !1 = $str
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        BIND_STATIC                                                  !1
    8     2        INIT_FCALL                                                   'mb_substr'
          3        SEND_VAR                                                     !1
          4        SEND_VAR                                                     !0
          5        SEND_VAL                                                     1
          6        DO_ICALL                                             $2      
          7      > RETURN                                                       $2
    9     8*     > RETURN                                                       null

End of Dynamic Function 0

End of function make_ascii

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.71 ms | 2175 KiB | 23 Q