PHP code example of hollodotme / cologne-phonetic

1. Go to this page and download the library: Download hollodotme/cologne-phonetic library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

hollodotme / cologne-phonetic example snippets




use hollodotme\ColognePhonetic\ColognePhonetic;

$inputCharset    = 'UTF-8';
$colognePhonetic = new ColognePhonetic( $inputCharset );

# Retrieve index for a single word
$wordIndex = $colognePhonetic->getWordIndex( 'Wort' );

var_dump( $wordIndex );

# Retrieve index for a phrase (multiple words)
# Phrase is split into words, returns an assoc. array with [ "word" => "index" ]
$phraseIndex = $colognePhonetic->getPhraseIndex( 'Ein Satz mit mehreren Wörtern' );

var_dump( $phraseIndex );