protected function stringToId( $string, $replace = '_' )
    {
        // First translit string to ASCII, as this characters are most probably
        // supported everywhere
        $string = iconv( 'UTF-8', 'ASCII//TRANSLIT', $string );

        // And then still replace any obscure characters by _ to ensure nothing
        // "bad" happens with this string.
        $string = preg_replace( '([^A-Za-z0-9.-]+)', $replace, $string );

        // Additionally we convert the string to lowercase, so that we get case
        // insensitive fetching
        return strtolower( $string );
    }
protected function stringToId( $string, $replace = '_' )
    {
        // First translit string to ASCII, as this characters are most probably
        // supported everywhere
        $string = iconv( 'UTF-8', 'ASCII//TRANSLIT', $string );

        // And then still replace any obscure characters by _ to ensure nothing
        // "bad" happens with this string.
        $string = preg_replace( '([^A-Za-z0-9.-]+)', $replace, $string );

        // Additionally we convert the string to lowercase, so that we get case
        // insensitive fetching
        return strtolower( $string );
    }
protected function stringToId ( $ string , $ replace = '_' ) { // First translit string to ASCII, as this characters are most probably // supported everywhere $ string = iconv ( 'UTF-8' , 'ASCII//TRANSLIT' , $ string ) ; // And then still replace any obscure characters by _ to ensure nothing // "bad" happens with this string. $ string = preg_replace ( '([^A-Za-z0-9.-]+)' , $ replace , $ string ) ; // Additionally we convert the string to lowercase, so that we get case // insensitive fetching return strtolower ( $ string ) ; }
Get ID string from arbitrary string

To calculate an ID string from an phpillowrary string, first iconvs
transliteration abilities are used, and after that all, but common ID
characters, are replaced by the given replace string, which defaults to
_.

@param string $string
@param string $replace
@return string
Get ID string from arbitrary string