3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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 "<BR>"; echo isStringOnlyAZSPACE("ST MARYS")?"true":"false"; // TRUE ?>
Output for 4.3.0 - 7.1.0
false<BR>true