PHP soundex() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The soundex() function is a built-in function in PHP and is used to calculate the Soundex key of a given string. The soundex key is a four character long alphanumeric string(starting with a letter) which represents the English pronunciation of the given string. Syntax: string soundex($str); Parameters: This function accepts a single parameter $str which represents the string for which we want to find the Soundex key. Return Value: It returns the soundex key as a string. Below programs illustrate the soundex() function in PHP: Program 1: In the below program, the soundex() function generates the soundex key of the string "geeksforgeeks". php <?php $str = "geeksforgeeks"; echo soundex($str); ?> Output: G216 Program 2: In the below program, we will see that two words having same pronunciation produce similar Soundex key. php <?php $str1 = "hair"; $str2 = "heir"; echo soundex($str1)."\n"; echo soundex($str2); ?> Output: H600 H600 Reference: https://www.php.net/manual/en/function.soundex.php Create Quiz Comment S Shivani2609 Follow 0 Improve S Shivani2609 Follow 0 Improve Article Tags : Misc Web Technologies PHP PHP-string Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like