ord
Convert the first byte of the string to a value between 0-255
ord()
function returns the ASCII value of the first character of the string.
Returns the ASCII value of "S":
<?php echo ord ( "S" ) . "<br>" ; echo ord ( "Shanghai" ) . "<br>" ; ?>
Try it yourself
ord ( string )
parameter | describe |
---|---|
string | Required. A string to get the ASCII value from it. |