Skip to content

Instantly share code, notes, and snippets.

@emmadesilva
Created May 6, 2024 11:45
Show Gist options
  • Select an option

  • Save emmadesilva/aa666a98f5d27a194b010e32a5036e72 to your computer and use it in GitHub Desktop.

Select an option

Save emmadesilva/aa666a98f5d27a194b010e32a5036e72 to your computer and use it in GitHub Desktop.
<?php
// PHP has a number of built-in functions that allow you to perform
// linguistic operations on strings with knowledge of phonetics,
// as well as the English language rules and pronunciations.
// Calculate the metaphone key of a string
echo metaphone('test'); // TST
// Calculate the soundex key of a string
echo soundex('test'); // T230
// Calculate Levenshtein distance between two strings
echo levenshtein('test', 'tset'); // 2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment