How to convert string to hexadecimal in PHP

2 Answers

0 votes
$s = 'php programming';
  
echo bin2hex($s);

  
     
/*
run:
          
7068702070726f6772616d6d696e67
   
*/

 



answered Oct 12, 2019 by avibootz
0 votes
$s = '1101';
  
echo bin2hex($s);

  
     
/*
run:
          
31313031
   
*/

 



answered Oct 12, 2019 by avibootz

Related questions

1 answer 346 views
1 answer 151 views
1 answer 222 views
1 answer 75 views
...