Current Location: Home> Function Categories> ord

ord

Convert the first byte of the string to a value between 0-255
Name:ord
Category:String
Programming Language:php
One-line Description:Returns the ASCII value of the first character in the string.

Definition and usage

ord() function returns the ASCII value of the first character of the string.

Example

Returns the ASCII value of "S":

 <?php
echo ord ( "S" ) . "<br>" ;
echo ord ( "Shanghai" ) . "<br>" ;
?>

Try it yourself

grammar

 ord ( string )
parameter describe
string Required. A string to get the ASCII value from it.
Similar Functions
  • Escape strings using backslash addslashes

    addslashes

    Escapestringsusingba
  • Find any one of a set of characters in a string - Return a substring that starts with the found character strpbrk

    strpbrk

    Findanyoneofasetofch
  • Find the first occurrence of a string strstr

    strstr

    Findthefirstoccurren
  • Alias ​​of rtrim chop

    chop

    Alias​​ofrtrim
  • Convert strings to arrays str_split

    str_split

    Convertstringstoarra
  • Remove spaces (or other characters) from the beginning of the string ltrim

    ltrim

    Removespaces(orother
  • Calculate the length of the first substring in which all characters in the string exist in the specified character set strspn

    strspn

    Calculatethelengthof
  • Get digital format information localeconv

    localeconv

    Getdigitalformatinfo
Popular Articles