- var_dump: documentation ( source)
- strpos: documentation ( source)
- preg_match: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$in = "";
function isNice($str) {
if(
strpos($str, "ab") !== false ||
strpos($str, "cd") !== false ||
strpos($str, "pq") !== false ||
strpos($str, "xy") !== false
) {
return false;
}
if(
3 > preg_match_all("/[aeiou]/i", $str, $match) ||
!preg_match("/([a-z])\\1/i", $str)
) {
return false;
}
return true;
}
var_dump(isNice("jchzalrnumimnmhp"));