How can you convert a single letter to ASCII code in PHP?

To convert a single letter to ASCII code in PHP, you can use the ord() function. This function takes a single character as input and returns its ASCII value. You can simply pass the letter as a parameter to the ord() function to get the ASCII code.

$letter = 'A';
$ascii_code = ord($letter);
echo "The ASCII code for the letter $letter is: $ascii_code";