sajad torkamani

Syntax:

preg_replace(
    string|array $pattern,
    string|array $replacement,
    string|array $subject
): string|array|null

Example (when passed a string):

function removeNonLetters($str) {
  return preg_replace(
    '/[^A-Za-z]/',
    '',
    $str
  );
}

echo removeNonLetters('sa.j.a--d') // => 'sajad'

Sources/links

Tagged: PHP