3v4l.org

run code in 300+ PHP versions simultaneously
<?php function stripSpecialCharater($string) { return preg_replace(['/\s{2,}|[\t\R]/u', '/[^a-z\d\s&‚~§©ÂÃ⃀-]/ui'], [' ', ''], $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 : "; var_export(stripSpecialCharater($test)); echo "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 14
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/VvVcc
function name:  (null)
number of ops:  16
compiled vars:  !0 = $tests, !1 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, <array>
   12     1      > FE_RESET_R                                       $3      !0, ->14
          2    > > FE_FETCH_R                                               $3, !1, ->14
   13     3    >   NOP                                                      
          4        FAST_CONCAT                                      ~4      !1, '+%3A+'
          5        ECHO                                                     ~4
   14     6        INIT_FCALL                                               'var_export'
          7        INIT_FCALL                                               'stripspecialcharater'
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
   15    12        ECHO                                                     '%0A'
   12    13      > JMP                                                      ->2
         14    >   FE_FREE                                                  $3
   16    15      > RETURN                                                   1

Function stripspecialcharater:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VvVcc
function name:  stripSpecialCharater
number of ops:  8
compiled vars:  !0 = $string
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    4     1        INIT_FCALL                                               'preg_replace'
          2        SEND_VAL                                                 <array>
          3        SEND_VAL                                                 <array>
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
    8     7*     > RETURN                                                   null

End of function stripspecialcharater

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.33 ms | 1399 KiB | 18 Q