Horje
string to lowercase accentuation hyphenated Code Example
string to lowercase accentuation hyphenated
<?php

/**
 * Converts string to SEO-friendly form (lowercase hyphenated alphanumeric words)
 *
 * @param $string
 * @return string
 */
function seoUrl($string)
{
    // qv stackoverflow.com/questions/11330480, stackoverflow.com/questions/1017599

    $src = 'àáâãäçèéêëìíîïñòóôõöøùúûüýÿßÀÁÂÃÄÇÈÉÊËÌÍÎÏÑÒÓÔÕÖØÙÚÛÜÝ';
    $rep = 'aaaaaceeeeiiiinoooooouuuuyysAAAAACEEEEIIIINOOOOOOUUUUY';

    // strip off accents (assuming utf8 PHP - note strtr() requires single-byte)
    $string = strtr(utf8_decode($string), utf8_decode($src), $rep);
    // convert to lower case
    $string = strtolower($string);
    // strip all but alphanumeric, whitespace, dot, underscore, hyphen
    $string = preg_replace("/[^a-z0-9\s._-]/", "", $string);
    // merge multiple consecutive whitespaces, dots, underscores, hyphens
    $string = preg_replace("/[\s._-]+/", " ", $string);
    // convert whitespaces to hyphens
    $string = preg_replace("/[\s]/", "-", $string);

    return $string;
}




Php

Related
how to disable auto prediction html input in laravel Code Example how to disable auto prediction html input in laravel Code Example
convert php code to html online Code Example convert php code to html online Code Example
create newfilter wordpress Code Example create newfilter wordpress Code Example
pagination javascript php Code Example pagination javascript php Code Example
PHP Resize Code Example PHP Resize Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8