3v4l.org

run code in 300+ PHP versions simultaneously
<?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;

preferences:
43.09 ms | 402 KiB | 5 Q