- preg_match_all: documentation ( source)
- var_export: documentation ( source)
<?php
$text = "Raphaƫl said you aren't coming home.";
function isValidLength($text, $length) {
return $length <= preg_match_all("~[\pL\pM'-]+~u", $text);
}
var_export(
[
5 => isValidLength($text, 5),
6 => isValidLength($text, 6),
7 => isValidLength($text, 7),
]
);