3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($str) { if (ltrim($str, 'A..Za..z0..9.') !== '') { return 'found a bad character'; } else { return 'all good'; } } foreach (['good', 'b@d', '$รท*'] as $s) { printf("%s : %s\n", $s, test($s)); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 1, Position 2 = 11
Branch analysis from position: 1
2 jumps found. (Code = 78) Position 1 = 2, Position 2 = 11
Branch analysis from position: 2
1 jumps found. (Code = 42) Position 1 = 1
Branch analysis from position: 1
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/rRpY2
function name:  (null)
number of ops:  13
compiled vars:  !0 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > FE_RESET_R                                       $1      <array>, ->11
          1    > > FE_FETCH_R                                               $1, !0, ->11
   13     2    >   INIT_FCALL                                               'printf'
          3        SEND_VAL                                                 '%25s+%3A+%25s%0A'
          4        SEND_VAR                                                 !0
          5        INIT_FCALL                                               'test'
          6        SEND_VAR                                                 !0
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   12    10      > JMP                                                      ->1
         11    >   FE_FREE                                                  $1
   14    12      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rRpY2
function name:  test
number of ops:  11
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'ltrim'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'A..Za..z0..9.'
          4        DO_ICALL                                         $1      
          5        IS_NOT_IDENTICAL                                         $1, ''
          6      > JMPZ                                                     ~2, ->9
    6     7    > > RETURN                                                   'found+a+bad+character'
    5     8*       JMP                                                      ->10
    8     9    > > RETURN                                                   'all+good'
   10    10*     > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.23 ms | 1006 KiB | 16 Q