w3resource
php Programming Exercies

PHP String Exercises : Get a hex dump of a string

PHP String: Exercise-16 with Solution

Write a PHP script to get a hex dump of a string.

Sample string : '[email protected]'

Sample Solution:

PHP Code:

<?php
$str = '[email protected]';
echo bin2hex($str)."\n";
?>

Sample Output:

72617979406578616d706c652e636f6d

Flowchart :

Flowchart: Get a hex dump of a string

PHP Code Editor:

Have another way to solve this solution? Contribute your code (and comments) through Disqus.

Previous: Write a PHP script to remove a part of a string from the beginning.
Next: Write a PHP script to insert a string at the specified position in a given string.

What is the difficulty level of this exercise?



New Content: Composer: Dependency manager for PHP, R Programming