October 2005
Intermediate to advanced
372 pages
11h 35m
English
chr()
string chr ( int ascii_val )To convert an ASCII number to its character equivalent, use the chr() function. This takes an ASCII value as its parameter and returns the character equivalent, if there is one.
$letter = chr(109);
print "ASCII number 109 is equivalent to $letter\n";That would output "ASCII number 109 is equivalent to m". The ord() function does the opposite of chr(): it takes a string and returns the equivalent ASCII value.