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)); //var_dump($str); foreach ($str as $k => $c) { if(ctype_upper($c)) { $u = true; $c = strtolower($c); } else { $u = false; } // print_r($c); if(in_array($c, $special)) { $c = $ascii[array_search($c, $special)]; } if($u) { $c = strtoupper($c); } $str[$k] = $c; } return join($str); } var_dump(make_ascii('áé'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HYlqj
function name:  (null)
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'make_ascii'
          2        SEND_VAL                                                 '%C3%A1%C3%A9'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
          6      > RETURN                                                   1

Function make_ascii:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 19, Position 2 = 51
Branch analysis from position: 19
2 jumps found. (Code = 78) Position 1 = 20, Position 2 = 51
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 31
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 43
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 48
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 48
Branch analysis from position: 43
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 43
Branch analysis from position: 37
Branch analysis from position: 43
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 51
filename:       /in/HYlqj
function name:  make_ascii
number of ops:  57
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, ->51
         19    > > FE_FETCH_R                                       ~15     $14, !3, ->51
         20    >   ASSIGN                                                   !4, ~15
   12    21        INIT_FCALL                                               'ctype_upper'
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $17     
         24      > JMPZ                                                     $17, ->31
   13    25    >   ASSIGN                                                   !5, <true>
   14    26        INIT_FCALL                                               'strtolower'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $19     
         29        ASSIGN                                                   !3, $19
   12    30      > JMP                                                      ->32
   16    31    >   ASSIGN                                                   !5, <false>
   19    32    >   INIT_FCALL                                               'in_array'
         33        SEND_VAR                                                 !3
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                         $22     
         36      > JMPZ                                                     $22, ->43
   20    37    >   INIT_FCALL                                               'array_search'
         38        SEND_VAR                                                 !3
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                         $23     
         41        FETCH_DIM_R                                      ~24     !2, $23
         42        ASSIGN                                                   !3, ~24
   22    43    > > JMPZ                                                     !5, ->48
   23    44    >   INIT_FCALL                                               'strtoupper'
         45        SEND_VAR                                                 !3
         46        DO_ICALL                                         $26     
         47        ASSIGN                                                   !3, $26
   25    48    >   ASSIGN_DIM                                               !0, !4
         49        OP_DATA                                                  !3
   11    50      > JMP                                                      ->19
         51    >   FE_FREE                                                  $14
   27    52        INIT_FCALL                                               'join'
         53        SEND_VAR                                                 !0
         54        DO_ICALL                                         $29     
         55      > RETURN                                                   $29
   28    56*     > 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/HYlqj
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:
146.85 ms | 1025 KiB | 25 Q