3v4l.org

run code in 300+ PHP versions simultaneously
<?php function sanitize($value) { $special_chars = array("?", "[", "]", "/", "\\", "=", "<", ">", ":", ";", ",", "'", "\"", "&", "$", "#", "*", "(", ")", "|", "~", "`", "!", "{", "}"); $value = utf8_encode($value); $value = str_replace($special_chars, '', $value); $value = preg_replace('/[\s-]+/', ' ', $value); $value = trim($value, '.-_'); return $value; } echo sanitize("hola como estas");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bcjNq
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   INIT_FCALL                                               'sanitize'
          1        SEND_VAL                                                 'hola+como+estas'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4      > RETURN                                                   1

Function sanitize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bcjNq
function name:  sanitize
number of ops:  25
compiled vars:  !0 = $value, !1 = $special_chars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        ASSIGN                                                   !1, <array>
    9     2        INIT_FCALL                                               'utf8_encode'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $3      
          5        ASSIGN                                                   !0, $3
   10     6        INIT_FCALL                                               'str_replace'
          7        SEND_VAR                                                 !1
          8        SEND_VAL                                                 ''
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $5      
         11        ASSIGN                                                   !0, $5
   11    12        INIT_FCALL                                               'preg_replace'
         13        SEND_VAL                                                 '%2F%5B%5Cs-%5D%2B%2F'
         14        SEND_VAL                                                 '+'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                         $7      
         17        ASSIGN                                                   !0, $7
   12    18        INIT_FCALL                                               'trim'
         19        SEND_VAR                                                 !0
         20        SEND_VAL                                                 '.-_'
         21        DO_ICALL                                         $9      
         22        ASSIGN                                                   !0, $9
   13    23      > RETURN                                                   !0
   14    24*     > RETURN                                                   null

End of function sanitize

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.74 ms | 946 KiB | 24 Q