- mb_convert_encoding: documentation ( source)
- print_r: documentation ( source)
- dechex: documentation ( source)
- ord: documentation ( source)
<?php
$utf8_to_iso8859_1_translation_table = array( );
$utf8_to_iso8859_1_translation_table2 = array( );
for( $a = 0; $a<256; $a++ )
{
$iso_8859_1 = mb_convert_encoding( "&#$a;" , 'ISO-8859-1' , 'HTML-ENTITIES' );
$utf8 = mb_convert_encoding( $iso_8859_1 , 'UTF-8' , 'ISO-8859-1' );
//$utf8 = utf8_encode( $iso_8859_1 );
$xutf8 = ( '\x' . dechex( ord( $utf8[0] ) ) . ( isset( $utf8[1] ) ? '\x' . dechex( ord( $utf8[1] ) ) . ( isset( $utf8[2] ) ? '\x' . dechex( ord( $utf8[2] ) ) : '' ) : '' ) );
$xiso = ( '\x' . dechex( ord( $iso_8859_1[0] ) ) . ( isset( $iso_8859_1[1] ) ? '\x' . dechex( ord( $iso_8859_1[1] ) ) : '' ) );
$utf8_to_iso8859_1_translation_table[$xutf8] = $xiso;// . ' ' . $a;
$utf8_to_iso8859_1_translation_table2[$utf8] = $iso_8859_1;// . ' ' . $a;
}
//print_r( $utf8_to_iso8859_1_translation_table );
print_r( $utf8_to_iso8859_1_translation_table2 );
die;