fork download
  1. <?php
  2.  
  3. function needsTransliteration(string $text): bool {
  4. // Returns true if there's any character that is NOT Latin script
  5. return preg_match('/[^\p{Latin}\p{Common}\p{Inherited}]/u', $text) === 1;
  6. }
  7.  
  8. var_dump(needsTransliteration("Martínez"));
Success #stdin #stdout 0.03s 25984KB
stdin
Standard input is empty
stdout
bool(false)