3v4l.org

run code in 500+ PHP versions simultaneously
<?php function stringValidator($field) { if(!empty($field) && preg_match('~[^a-z\d]~i', $field)) { return "You typed $field: please don't use special characters '<' '>' '_' '/' etc."; } return "valid"; // empty or valid } $strings = ["hello", "what_the"]; foreach ($strings as $string) { echo "$string: " , stringValidator($string) , "\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/si9KO
function name:  (null)
number of ops:  14
compiled vars:  !0 = $strings, !1 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ASSIGN                                                       !0, <array>
   10     1      > FE_RESET_R                                           $3      !0, ->12
          2    > > FE_FETCH_R                                                   $3, !1, ->12
   11     3    >   NOP                                                          
          4        FAST_CONCAT                                          ~4      !1, '%3A+'
          5        ECHO                                                         ~4
          6        INIT_FCALL                                                   'stringvalidator'
          7        SEND_VAR                                                     !1
          8        DO_FCALL                                          0  $5      
          9        ECHO                                                         $5
         10        ECHO                                                         '%0A'
   10    11      > JMP                                                          ->2
         12    >   FE_FREE                                                      $3
   12    13      > RETURN                                                       1

Function stringvalidator:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/si9KO
function name:  stringValidator
number of ops:  13
compiled vars:  !0 = $field
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   RECV                                                 !0      
    3     1        ISSET_ISEMPTY_CV                                     ~1      !0
          2        BOOL_NOT                                             ~2      ~1
          3      > JMPZ_EX                                              ~2      ~2, ->6
          4    >   FRAMELESS_ICALL_2                preg_match          ~3      '%7E%5B%5Ea-z%5Cd%5D%7Ei', !0
          5        BOOL                                                 ~2      ~3
          6    > > JMPZ                                                         ~2, ->11
    4     7    >   ROPE_INIT                                         3  ~5      'You+typed+'
          8        ROPE_ADD                                          1  ~5      ~5, !0
          9        ROPE_END                                          2  ~4      ~5, '%3A+please+don%27t+use+special+characters+%27%3C%27+%27%3E%27+%27_%27+%27%2F%27+etc.'
         10      > RETURN                                                       ~4
    6    11    > > RETURN                                                       'valid'
    7    12*     > RETURN                                                       null

End of function stringvalidator

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
142.32 ms | 2608 KiB | 14 Q