3v4l.org

run code in 500+ PHP versions simultaneously
<?php function contains_prohibited($string, $chars) { return strcspn($string, $chars) < strlen($string); } $string = "Prohibited symbols are ampersands, dollar signs, and semicolons."; var_dump(contains_prohibited($string, "&$;")); $string .= "And commas."; var_dump(contains_prohibited($string, "&$;,"));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3orE
function name:  (null)
number of ops:  17
compiled vars:  !0 = $string
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   ASSIGN                                                       !0, 'Prohibited+symbols+are+ampersands%2C+dollar+signs%2C+and+semicolons.'
    9     1        INIT_FCALL                                                   'var_dump'
          2        INIT_FCALL                                                   'contains_prohibited'
          3        SEND_VAR                                                     !0
          4        SEND_VAL                                                     '%26%24%3B'
          5        DO_FCALL                                          0  $2      
          6        SEND_VAR                                                     $2
          7        DO_ICALL                                                     
   11     8        ASSIGN_OP                                         8          !0, 'And+commas.'
   13     9        INIT_FCALL                                                   'var_dump'
         10        INIT_FCALL                                                   'contains_prohibited'
         11        SEND_VAR                                                     !0
         12        SEND_VAL                                                     '%26%24%3B%2C'
         13        DO_FCALL                                          0  $5      
         14        SEND_VAR                                                     $5
         15        DO_ICALL                                                     
         16      > RETURN                                                       1

Function contains_prohibited:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G3orE
function name:  contains_prohibited
number of ops:  10
compiled vars:  !0 = $string, !1 = $chars
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    4     2        INIT_FCALL                                                   'strcspn'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                             $2      
          6        STRLEN                                               ~3      !0
          7        IS_SMALLER                                           ~4      $2, ~3
          8      > RETURN                                                       ~4
    5     9*     > RETURN                                                       null

End of function contains_prohibited

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.31 ms | 2247 KiB | 17 Q