3v4l.org

run code in 300+ PHP versions simultaneously
<?php function isStringOnlyAZSPACE($the_string) { $valid_chars = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',' '); $the_string = str_replace($valid_chars, "", $the_string); return (strlen($the_string)==0); } echo isStringOnlyAZSPACE("ST MARY'S")?"true":"false"; // FALSE echo isStringOnlyAZSPACE("ST MARYS")?"true":"false"; // TRUE ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
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: 6
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
Branch analysis from position: 14
filename:       /in/KTt9g
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'isstringonlyazspace'
          1        SEND_VAL                                                 'ST+MARY%27S'
          2        DO_FCALL                                      0  $0      
          3      > JMPZ                                                     $0, ->6
          4    >   QM_ASSIGN                                        ~1      'true'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~1      'false'
          7    >   ECHO                                                     ~1
   17     8        INIT_FCALL                                               'isstringonlyazspace'
          9        SEND_VAL                                                 'ST+MARYS'
         10        DO_FCALL                                      0  $2      
         11      > JMPZ                                                     $2, ->14
         12    >   QM_ASSIGN                                        ~3      'true'
         13      > JMP                                                      ->15
         14    >   QM_ASSIGN                                        ~3      'false'
         15    >   ECHO                                                     ~3
   18    16      > RETURN                                                   1

Function isstringonlyazspace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KTt9g
function name:  isStringOnlyAZSPACE
number of ops:  12
compiled vars:  !0 = $the_string, !1 = $valid_chars
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    5     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 ''
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $3      
          7        ASSIGN                                                   !0, $3
    9     8        STRLEN                                           ~5      !0
          9        IS_EQUAL                                         ~6      ~5, 0
         10      > RETURN                                                   ~6
   10    11*     > RETURN                                                   null

End of function isstringonlyazspace

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
156.24 ms | 1399 KiB | 17 Q