3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripSpecialCharater($string) { $string = iconv("Windows-1252","UTF-8",urldecode($string)); $string = preg_replace(array('/\s{2,}/', '/[\t\n]/'), ' ', $string); return preg_replace('/[^a-zA-Z0-9ç&-©‚ƒ‘\s]/', '', $string); } $tests = ['12 34', 'adsf', 'co©', 'pound £']; foreach ($tests as $test) { echo "$test : " , stripSpecialCharater($test), "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 12
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 12
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/ZiXXb
function name:  (null)
number of ops:  14
compiled vars:  !0 = $tests, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                   !0, <array>
   11     1      > FE_RESET_R                                       $3      !0, ->12
          2    > > FE_FETCH_R                                               $3, !1, ->12
   12     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~4      !1, '+%3A+'
          5        ECHO                                                     ~4
          6        INIT_FCALL                                               'stripspecialcharater'
          7        SEND_VAR                                                 !1
          8        DO_FCALL                                      0  $5      
          9        ECHO                                                     $5
         10        ECHO                                                     '%0A'
   11    11      > JMP                                                      ->2
         12    >   FE_FREE                                                  $3
   13    13      > RETURN                                                   1

Function stripspecialcharater:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZiXXb
function name:  stripSpecialCharater
number of ops:  23
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL_BY_NAME                                       'iconv'
          2        SEND_VAL_EX                                              'Windows-1252'
          3        SEND_VAL_EX                                              'UTF-8'
          4        INIT_FCALL                                               'urldecode'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $1      
          7        SEND_VAR_NO_REF_EX                                       $1
          8        DO_FCALL                                      0  $2      
          9        ASSIGN                                                   !0, $2
    5    10        INIT_FCALL                                               'preg_replace'
         11        SEND_VAL                                                 <array>
         12        SEND_VAL                                                 '+'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $4      
         15        ASSIGN                                                   !0, $4
    6    16        INIT_FCALL                                               'preg_replace'
         17        SEND_VAL                                                 '%2F%5B%5Ea-zA-Z0-9%C3%83%C2%A7%26-%C2%A9%E2%80%9A%C3%82%C6%92%C3%A2%E2%82%AC%CB%9C%5Cs%5D%2F'
         18        SEND_VAL                                                 ''
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                         $6      
         21      > RETURN                                                   $6
    7    22*     > RETURN                                                   null

End of function stripspecialcharater

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.77 ms | 1403 KiB | 18 Q