PHP unicode_decode (5.3)

unicode_decode — Decode Unicode, convert a binary string into a Unicode string for PHP 5.3, this function will be introduced in PHP 6.

function unicode_decode($string) {

    $string = preg_replace_callback('#\\\\u([0-9a-f]{4})#ism',
    create_function('$matches', 'return mb_convert_encoding(pack("H*", $matches[1]), "UTF-8", "UCS-2BE");'), 
    $string);
    
    return $string;
    
}



Raska Top\u010dagi\u0107 = Raska Topčagić
©2009-2011 Webarto • web design & development • Tuzla // Sarajevo // Beograd