Skip to content


Convert Character to ASCII Code

This sections will contains code regarding different PHP & MySQL features and contains help about php/mysql issues.

Convert Character to ASCII Code

Postby Web Guru » November 18th, 2008, 6:20 am

In PHP, you can get the ascii code of any character using a built-in function "ord". There is also a function to convert the ascii code into a character named "chr".

They are very simple to use and can be helpful in certain cirumsyances.

Examples:
Code: Select all
$a = "A";
print ord($a); // prints 65 (ASCII code of 'A'

$a = 65;
print chr($a); // prints 'A'
User avatar
Web Guru
 
Posts: 94
Joined: March 24th, 2008, 7:59 am
Location: Lahore, Pakistan

Return to Board index

Return to PHP / MySQL / XML

Who is online

Users browsing this forum: No registered users and 0 guests