- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
bin2hex() function in PHP
The bin2hex() function is used to convert primary data to hexadecimal representation
Syntax
bin2hex(str)
Parameters
str − The string to be converted.
Return
The bin2hex() function converts a string of ASCII characters to hexadecimal values.
The following is an example −
Example
<?php $s = bin2hex("Welcome!"); echo($s); ?>
The following is the output −
Output
57656c636f6d6521
Let us see another example −
Example
<?php $val = bin2hex("1011"); echo($val); ?>
The following is the output −
Output
31303131
Advertisements