How to get the ASCII value of a character in PHP

2 Answers

0 votes
$ch = 'a';
$ascii = ord($ch);
echo $ascii;


/*
run:

97
   
*/

 



answered Apr 3, 2017 by avibootz
edited Apr 3, 2017 by avibootz
0 votes
$ch = "\n";
$ascii = ord($ch);
echo $ascii;


/*
run:

10
   
*/

 



answered Apr 3, 2017 by avibootz
edited Apr 3, 2017 by avibootz

Related questions

...