3v4l.org

run code in 300+ 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, "&$;,"));
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.24, 7.4.0 - 7.4.13, 8.0.0
bool(false) bool(true)