php basics
PHP bin2hex function
The function of PHP bin2hex function is to convert a binary data into hexadecimal data. Assuming there is a binary string, it can be converted to hexadecimal through PHP bin2hex function The ASCII result of the system indicates that the bin2hex function has only one parameter available, and the advantage is that it can quickly convert strings.
PHP bin2hex function syntax
bin2hex (string to be converted);
The PHP bin2hex function has only one parameter position that can be used. It is a necessary item, in the form of a string. The bin2hex function will treat the string as binary data, and then automatically convert it to hexadecimal data, and return the conversion result.PHP bin2hex function example
<?php
$TestString='Welcome to Wibibi.';
echo $TestString.'<br>';
echo bin2hex($TestString);
?>
Example output$TestString='Welcome to Wibibi.';
echo $TestString.'<br>';
echo bin2hex($TestString);
?>
Welcome to Wibibi.
57656c636f6d6520746f205769626962692e
When the example is opened, a string $TestString is prepared first. We use echo to display this string on the screen, and then let bin2hex convert the content of the string into hexadecimal data in the next line. It will look like The string on the second line of the example output is the string conversion function of the PHP bin2hex function.
57656c636f6d6520746f205769626962692e
Post a Comment
0 Comments