| 
<?php
/*************************************************************
 * This script is developed by Arturs Sosins aka ar2rsawseen, http://webcodingeasy.com
 * Feel free to distribute and modify code, but keep reference to its creator
 *
 * Phone spell class can generate words that represent dialing for provided phone number.
 * It also calculates word weight in numbers to order found variations
 * starting from most promising ones.
 *
 * For more information, examples and online documentation visit:
 * http://webcodingeasy.com/PHP-classes/Spell-your-phone-number
 **************************************************************/
 //it could take some time
 set_time_limit(0);
 //measure time
 $time = microtime();
 $time = explode(' ', $time);
 $start = $time[1] + $time[0];
 
 //including original class
 include("./phone_spell.php");
 class custom_spell extends phone_spell
 {
 /****************************
 * CUSTOM DICTIONARY FUNCTIONS
 ****************************/
 
 //initialize dictionary
 protected function dictionary_init(){
 $str = file_get_contents("./custom_dictionary.txt");
 $parts = explode("\r\n", $str);
 foreach($parts as $part)
 {
 $this->dict[$part] = true;
 }
 }
 
 //return false if word is incorrect
 //or true if word is correct
 protected function dictionary_check($word){
 $ret = false;
 if(strlen($word) > 2)
 {
 if(isset($this->dict[$word]))
 {
 $ret = true;
 }
 }
 return $ret;
 }
 }
 
 //use custom class
 $ws = new custom_spell();
 echo "<pre>";
 //your phone number here
 $arr = $ws->get("8004659269");
 print_r($arr);
 
 //end time
 $time = microtime();
 $time = explode(' ', $time);
 $end = $time[1] + $time[0];
 $total_time = round(($end - $start), 4);
 echo '<p>PHP execution: '.$total_time.' seconds.</p>';
 ?>
 
 |