3v4l.org

run code in 300+ PHP versions simultaneously
<?php setlocale(LC_ALL, 'en_US.UTF8'); function toAscii($str, $replace=array(), $delimiter='-') { if( !empty($replace) ) { $str = str_replace((array)$replace, ' ', $str); } $clean = iconv('UTF-8', 'ASCII//TRANSLIT', $str); $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $clean); $clean = strtolower(trim($clean, '-')); $clean = preg_replace("/[\/_|+ -]+/", $delimiter, $clean); return $clean; } toAscii("Captain America and how to not look at the camera"); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3Lpvk
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'setlocale'
          1        SEND_VAL                                                 6
          2        SEND_VAL                                                 'en_US.UTF8'
          3        DO_ICALL                                                 
   16     4        INIT_FCALL                                               'toascii'
          5        SEND_VAL                                                 'Captain+America+and+how+to+not+look+at+the+camera'
          6        DO_FCALL                                      0          
   18     7      > RETURN                                                   1

Function toascii:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/3Lpvk
function name:  toAscii
number of ops:  41
compiled vars:  !0 = $str, !1 = $replace, !2 = $delimiter, !3 = $clean
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
          2        RECV_INIT                                        !2      '-'
    4     3        ISSET_ISEMPTY_CV                                 ~4      !1
          4        BOOL_NOT                                         ~5      ~4
          5      > JMPZ                                                     ~5, ->13
    5     6    >   INIT_FCALL                                               'str_replace'
          7        CAST                                          7  ~6      !1
          8        SEND_VAL                                                 ~6
          9        SEND_VAL                                                 '+'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                         $7      
         12        ASSIGN                                                   !0, $7
    8    13    >   INIT_FCALL_BY_NAME                                       'iconv'
         14        SEND_VAL_EX                                              'UTF-8'
         15        SEND_VAL_EX                                              'ASCII%2F%2FTRANSLIT'
         16        SEND_VAR_EX                                              !0
         17        DO_FCALL                                      0  $9      
         18        ASSIGN                                                   !3, $9
    9    19        INIT_FCALL                                               'preg_replace'
         20        SEND_VAL                                                 '%2F%5B%5Ea-zA-Z0-9%5C%2F_%7C%2B+-%5D%2F'
         21        SEND_VAL                                                 ''
         22        SEND_VAR                                                 !3
         23        DO_ICALL                                         $11     
         24        ASSIGN                                                   !3, $11
   10    25        INIT_FCALL                                               'strtolower'
         26        INIT_FCALL                                               'trim'
         27        SEND_VAR                                                 !3
         28        SEND_VAL                                                 '-'
         29        DO_ICALL                                         $13     
         30        SEND_VAR                                                 $13
         31        DO_ICALL                                         $14     
         32        ASSIGN                                                   !3, $14
   11    33        INIT_FCALL                                               'preg_replace'
         34        SEND_VAL                                                 '%2F%5B%5C%2F_%7C%2B+-%5D%2B%2F'
         35        SEND_VAR                                                 !2
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $16     
         38        ASSIGN                                                   !3, $16
   13    39      > RETURN                                                   !3
   14    40*     > RETURN                                                   null

End of function toascii

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.71 ms | 1403 KiB | 24 Q