How to get a hex dump of a string in PHP?

Spread the love

Sometimes, we want to get a hex dump of a string in PHP.

In this article, we’ll look at how to get a hex dump of a string in PHP.

How to get a hex dump of a string in PHP?

To get a hex dump of a string in PHP, we can use the bin2hex function.

For instance, we write

echo bin2hex($string);

to call bin2hex with $string to return the hex dump of the string $string.

Conclusion

To get a hex dump of a string in PHP, we can use the bin2hex function.

Leave a Reply

Your email address will not be published.