ドロップダウンリストを表示

iconv()

« hypot | iconv_get_encoding »
<?php
$string 
iconv (
    
?// string $in_charset
    
?// string $out_charset
    
  // string $str
);

// enter non ASCII characters in hex in $str if $in_charset is not UTF-8
// the converted $string may not display properly if $out_charset is not UTF-8

// shows the encoding difference in hexadecimal
// note that $str below actually represents an argument
$hex unpack("H*in_charset"$str) + unpack("H*out_charset"$string);
?>
結果
$string = 'This is the Euro symbol \'EUR\'.'
$hex = [
  
'in__charset' => '5468697320697320746865204575726f2073796d626f6c2027e282ac272e',
  
'out_charset' => '5468697320697320746865204575726f2073796d626f6c2027455552272e',
]
#1 iconv  ("UTF-8",
 
"ISO-8859-1//TRANSLIT",
 
"This is the Euro symbol '€'.")
#2 iconv  ("UTF-8",
 
"ISO-8859-1//IGNORE",
 
"This is the British Pound symbol '£'.")
#3 iconv  ("UTF-8",
 
"ISO-8859-1",
 
"This is the Euro symbol '€'.")
#4 iconv  ("UTF-8",
 
"ISO-8859-1",
 
"à")
#5 iconv  ("ISO-8859-1",
 
"UTF-8",
 
"\xe0")
参照
iconv_get_encoding, iconv_mime_decode, iconv_mime_decode_headers, iconv_mime_encode, iconv_set_encoding, iconv_strlen, iconv_strpos, iconv_strrpos, iconv_substr, unpack