function checkString($subject){ $pattern = "[^_a-zA-Z0-9-]"; if(preg_match($pattern, $subject, $regs)){ return false; } else { return true; } } $num = $_GET['num']; if($num == "" || checkString($num)== false){ $num = "ryo"; } ?>