Reference - Parms functions - bin2hex


App: regression/framework - Page: expressions/a_hex_literal_with_an_odd_number_of_digits_is_read_as_its_value
PHP
HTML
expressions/a_hex_literal_with_an_odd_number_of_digits_is_read_as_its_value.pad
Result
[{echo 0xABC | php:bin2hex}][{echo 0x4142}]


App: regression/framework - Page: functions/a_cut_from_the_end_of_a_long_text_with_a_broken_byte_counts_code_points
PHP
functions/a_cut_from_the_end_of_a_long_text_with_a_broken_byte_counts_code_points.php
HTML
functions/a_cut_from_the_end_of_a_long_text_with_a_broken_byte_counts_code_points.pad
Result
<?php

// A text with a byte that is no UTF-8, far before its end: it is cut in code points, as
// the same text is when the byte stands near the end.

$tail = "ab\u{1F1F3}\u{1F1F1}e\u{301}";
$long = "\xFF" . str_repeat ( 'a', 5000 ) . $tail;
$short = "\xFF" . str_repeat ( 'a', 10 ) . $tail;

?>
[{echo $long | right(1) | php:bin2hex(@)}][{echo $long | right(2) | php:bin2hex(@)}][{echo $long | substr(-3, 1) | php:bin2hex(@)}][{echo $short | right(1) | php:bin2hex(@)}]


App: regression/framework - Page: functions/the_cutting_functions_count_the_characters_a_reader_sees
PHP
functions/the_cutting_functions_count_the_characters_a_reader_sees.php
HTML
functions/the_cutting_functions_count_the_characters_a_reader_sees.pad
Result
<?php

$flag
= "\u{1F1F3}\u{1F1F1} NL";
$nfd = "e\u{0301}cole";
$fam = "a\u{1F468}\u{200D}\u{1F469}\u{200D}\u{1F467}";

?>
[{echo $flag | left(1) | php:bin2hex(@)}][{echo $nfd | left(1) | php:bin2hex(@)}][{echo $fam | right(1) | php:bin2hex(@)}][{echo $nfd | mid(2, 2)}][{echo $flag | max_len(1) | php:bin2hex(@)}][{echo $nfd | substr(1)}][{echo $nfd | truncate(3, '.') | php:bin2hex(@)}]


App: regression/framework - Page: functions/the_cutting_functions_keep_a_character_whole_at_the_end_of_a_long_text
PHP
functions/the_cutting_functions_keep_a_character_whole_at_the_end_of_a_long_text.php
HTML
functions/the_cutting_functions_keep_a_character_whole_at_the_end_of_a_long_text.pad
Result
<?php

// Past 4096 bytes right() and substr() from the end read a window at the end of the text,
// not the whole of it: a run of flags, whose pairs count from the run's start, and an
// accent written apart must come out whole there too.

$flags = str_repeat ( "\u{1F1F3}\u{1F1F1}", 3001 );
$accent = str_repeat ( "e\u{0301}", 3000 ) . "ab";

?>
[{echo $flags | right(1) | php:bin2hex(@)}][{echo $flags | substr(-2, 1) | php:bin2hex(@)}][{echo $accent | right(3) | php:bin2hex(@)}][{echo $accent | mid(3000, 1) | php:bin2hex(@)}][{echo $accent | truncate(3, '') | php:bin2hex(@)}]