3v4l.org

run code in 500+ PHP versions simultaneously
<?php function stringValidator($field) { if(!empty($field) && !ctype_alnum($field)) { return "You typed $field: please use only alphanumeric characters"; } 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/XTFgJ
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 = 9
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 14
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/XTFgJ
function name:  stringValidator
number of ops:  16
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, ->9
          4    >   INIT_FCALL                                                   'ctype_alnum'
          5        SEND_VAR                                                     !0
          6        DO_ICALL                                             $3      
          7        BOOL_NOT                                             ~4      $3
          8        BOOL                                                 ~2      ~4
          9    > > JMPZ                                                         ~2, ->14
    4    10    >   ROPE_INIT                                         3  ~6      'You+typed+'
         11        ROPE_ADD                                          1  ~6      ~6, !0
         12        ROPE_END                                          2  ~5      ~6, '%3A+please+use+only+alphanumeric+characters'
         13      > RETURN                                                       ~5
    6    14    > > RETURN                                                       'valid'
    7    15*     > RETURN                                                       null

End of function stringvalidator

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
165.33 ms | 3362 KiB | 15 Q