-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathfingerprint.php
More file actions
28 lines (20 loc) · 1013 Bytes
/
Copy pathfingerprint.php
File metadata and controls
28 lines (20 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
function finger_print ($str)
{
// Convert accented characters
$str = strtr(utf8_decode($str),
utf8_decode("ÀÁÂÃÄÅàáâãäåĀāĂ㥹ÇçĆćĈĉĊċČčÐðĎďĐđÈÉÊËèéêëĒēĔĕĖėĘęĚěĜĝĞğĠġĢģĤĥĦħÌÍÎÏìíîïĨĩĪīĬĭĮįİıĴĵĶķĸĹĺĻļĽľĿŀŁłÑñŃńŅņŇňʼnŊŋÒÓÔÕÖØòóôõöøŌōŎŏŐőŔŕŖŗŘřŚśŜŝŞşŠšſŢţŤťŦŧÙÚÛÜùúûüŨũŪūŬŭŮůŰűŲųŴŵÝýÿŶŷŸŹźŻżŽž"),
"aaaaaaaaaaaaaaaaaaccccccccccddddddeeeeeeeeeeeeeeeeeegggggggghhhhiiiiiiiiiiiiiiiiiijjkkkllllllllllnnnnnnnnnnnoooooooooooooooooorrrrrrsssssssssttttttuuuuuuuuuuuuuuuuuuuuwwyyyyyyzzzzzz");
$str = utf8_encode($str);
// lowercase
$str = strtolower($str);
// normalise space
$str = preg_replace('/\s\s+/', ' ', $str);
// strip punctuation
$str = preg_replace('/[,|\.|\(|\)|-]/', '', $str);
// strip and|&
$str = preg_replace('/ and /', ' ', $str);
$str = preg_replace('/ & /', ' ', $str);
return $str;
}
?>