Using the string functions

Functions that convert between stringsand ASCII integer values

chr($value)
ord($string)

How to convert an integer value to a string

<?php
  $char = chr(65);      // $char is 'A'
  $char = chr(66);      // $char is 'B'
?>

How to convert a character to an integer value

<?php
  $val = ord('A');      // $val is 65
  $val = ord('B');      // $val is 66
  $val = ord('Bike');   // $val is 66
?>

Back