Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Here's what I've done. I think I've covered most of the "common" characters. Obviously, it's going to be missing some however.</p> <pre><code>/** * Replaces special characters in a string with their "non-special" counterpart. * * Useful for friendly URLs. * * @param string * @return string */ function convertAccentsAndSpecialToNormal($string) { $table = array( 'À'=&gt;'A', 'Á'=&gt;'A', 'Â'=&gt;'A', 'Ã'=&gt;'A', 'Ä'=&gt;'A', 'Å'=&gt;'A', 'Ă'=&gt;'A', 'Ā'=&gt;'A', 'Ą'=&gt;'A', 'Æ'=&gt;'A', 'Ǽ'=&gt;'A', 'à'=&gt;'a', 'á'=&gt;'a', 'â'=&gt;'a', 'ã'=&gt;'a', 'ä'=&gt;'a', 'å'=&gt;'a', 'ă'=&gt;'a', 'ā'=&gt;'a', 'ą'=&gt;'a', 'æ'=&gt;'a', 'ǽ'=&gt;'a', 'Þ'=&gt;'B', 'þ'=&gt;'b', 'ß'=&gt;'Ss', 'Ç'=&gt;'C', 'Č'=&gt;'C', 'Ć'=&gt;'C', 'Ĉ'=&gt;'C', 'Ċ'=&gt;'C', 'ç'=&gt;'c', 'č'=&gt;'c', 'ć'=&gt;'c', 'ĉ'=&gt;'c', 'ċ'=&gt;'c', 'Đ'=&gt;'Dj', 'Ď'=&gt;'D', 'Đ'=&gt;'D', 'đ'=&gt;'dj', 'ď'=&gt;'d', 'È'=&gt;'E', 'É'=&gt;'E', 'Ê'=&gt;'E', 'Ë'=&gt;'E', 'Ĕ'=&gt;'E', 'Ē'=&gt;'E', 'Ę'=&gt;'E', 'Ė'=&gt;'E', 'è'=&gt;'e', 'é'=&gt;'e', 'ê'=&gt;'e', 'ë'=&gt;'e', 'ĕ'=&gt;'e', 'ē'=&gt;'e', 'ę'=&gt;'e', 'ė'=&gt;'e', 'Ĝ'=&gt;'G', 'Ğ'=&gt;'G', 'Ġ'=&gt;'G', 'Ģ'=&gt;'G', 'ĝ'=&gt;'g', 'ğ'=&gt;'g', 'ġ'=&g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;' 1/3 ', '⅔'=&gt;' 2/3 ', '⅛'=&gt;' 1/8 ', '⅜'=&gt;' 3/8 ', '⅝'=&gt;' 5/8 ', '⅞'=&gt;' 7/8 ', '÷'=&gt;' divided by ', '×'=&gt;' times ', '±'=&gt;' plus-minus ', '√'=&gt;' square root ', '∞'=&gt;' infinity ', '≈'=&gt;' almost equal to ', '≠'=&gt;' not equal to ', '≡'=&gt;' identical to ', '≤'=&gt;' less than or equal to ', '≥'=&gt;' greater than or equal to ', '←'=&gt;' left ', '→'=&gt;' right ', '↑'=&gt;' up ', '↓'=&gt;' down ', '↔'=&gt;' left and right ', '↕'=&gt;' up and down ', '℅'=&gt;' care of ', '℮' =&gt; ' estimated ', 'Ω'=&gt;' ohm ', '♀'=&gt;' female ', '♂'=&gt;' male ', '©'=&gt;' Copyright ', '®'=&gt;' Registered ', '™' =&gt;' Trademark ', ); $string = strtr($string, $table); // Currency symbols: £¤¥€ - we dont bother with them for now $string = preg_replace("/[^\x9\xA\xD\x20-\x7F]/u", "", $string); return $string; } /** * Create URL Title * * Takes a "title" string as input and creates a human-friendly URL string. * * @param string * @param boolean * @return string */ if (!function_exists('friendlyUrl')) { function friendlyUrl($string, $lowercase = TRUE) { $separator = '-'; if (function_exists('convertAccentsAndSpecialToNormal')) { $string = convertAccentsAndSpecialToNormal($string); } $trans = array( '/&amp;\#\d+?;/i' =&gt; '', '/&amp;\S+?;/i' =&gt; '', '/\.+/i' =&gt; '', '/\s+/' =&gt; $separator, '/\/+/' =&gt; $separator, '/[^a-z0-9\-\._]/i' =&gt; '', '/'. $separator .'+/' =&gt; $separator, '/'. $separator .'$/' =&gt; $separator, '/^'. $separator .'/' =&gt; $separator, '/\.+$/' =&gt; '' ); $string = strip_tags($string); $string = preg_replace(array_keys($trans), array_values($trans), $string); if ($lowercase === TRUE) { $string = strtolower($string); } return trim(stripslashes($string)); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload