Improved www.ttss.krakow.pl
Jacek Kowalski
2019-07-07 ae517065da8e530f3964b0cbf4ecf90c2c71b948
commit | author | age
ced309 1 <?php
JK 2 setlocale(LC_CTYPE, 'pl_PL.UTF-8');
3
4 function split_stop_name($string) {
5     $string = strtolower(iconv('utf-8', 'ascii//TRANSLIT', $string));
6     $words = preg_split('/\\W+/', $string);
7     
8     foreach($words as &$word) {
9         $two = substr($word, 0, 2);
10         if($two == 'os') $word = 'os';
11         elseif($two == 'al') $word = 'al';
12         elseif($two == 'sw') $word = 'sw';
13     }
14     unset($word);
15     
cbce8b 16     return array_values($words);
ced309 17 }
ca42d3 18
JK 19 function normalize_name($string) {
20     return strtr(strtr($string, ['.' => '. ']), ['  ' => ' ']);
21 }
22
23 function normalize_name_cmp($string) {
24     return normalize_name(mb_strtolower($string, 'UTF-8'));
25 }