How to turn each character of a string into its ASCII character code in PHP

1 Answer

0 votes
$s = "php programming";
$len = strlen($s);

for ($i = 0; $i < $len; $i++)
     echo ord($s[$i]) . ' ';
  
     
     
/*
run:

112 104 112 32 112 114 111 103 114 97 109 109 105 110 103 

*/

 



answered Apr 3, 2021 by avibootz
...