3v4l.org

run code in 300+ 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 = 53
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 53
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 = 39, Position 2 = 45
Branch analysis from position: 39
2 jumps found. (Code = 43) Position 1 = 46, Position 2 = 50
Branch analysis from position: 46
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 50
Branch analysis from position: 45
Branch analysis from position: 33
2 jumps found. (Code = 43) Position 1 = 39, Position 2 = 45
Branch analysis from position: 39
Branch analysis from position: 45
Branch analysis from position: 53
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 53
filename:       /in/Bo1SF
function name:  make_ascii
number of ops:  59
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, ->53
         19    > > FE_FETCH_R                                       ~15     $14, !3, ->53
         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    >   INIT_FCALL                                               'in_array'
         35        SEND_VAR                                                 !3
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                         $23     
         38      > JMPZ                                                     $23, ->45
   20    39    >   INIT_FCALL                                               'array_search'
         40        SEND_VAR                                                 !3
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                         $24     
         43        FETCH_DIM_R                                      ~25     !2, $24
         44        ASSIGN                                                   !3, ~25
   22    45    > > JMPZ                                                     !5, ->50
   23    46    >   INIT_FCALL                                               'mb_strtoupper'
         47        SEND_VAR                                                 !3
         48        DO_ICALL                                         $27     
         49        ASSIGN                                                   !3, $27
   25    50    >   ASSIGN_DIM                                               !0, !4
         51        OP_DATA                                                  !3
   11    52      > JMP                                                      ->19
         53    >   FE_FREE                                                  $14
   27    54        INIT_FCALL                                               'join'
         55        SEND_VAR                                                 !0
         56        DO_ICALL                                         $30     
         57      > RETURN                                                   $30
   28    58*     > 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}
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.0.0


preferences:
228.04 ms | 1023 KiB | 24 Q