當前位置: 首頁> 函數類別大全> ord

ord

轉換字符串第一個字節為0-255 之間的值
名稱:ord
分類:字符串
所屬語言:php
一句話介紹:返回字符串中第一個字符的ASCII 值。

實例

返回"S" 的ASCII值:

 <span class="token php language-php"><span class="token delimiter important"><?php</span>
<span class="token keyword">echo</span> <span class="token function">ord</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"S"</span> <span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token string double-quoted-string">"<br>"</span> <span class="token punctuation">;</span>
<span class="token keyword">echo</span> <span class="token function">ord</span> <span class="token punctuation">(</span> <span class="token string double-quoted-string">"Shanghai"</span> <span class="token punctuation">)</span> <span class="token operator">.</span> <span class="token string double-quoted-string">"<br>"</span> <span class="token punctuation">;</span>
<span class="token delimiter important">?></span></span>

親自試一試

同類函數
  • 查找指定字符在字符串中的最後一次出現 strrchr

    strrchr

    查找指定字符在字符串中的最後一次出現
  • 打斷字符串為指定數量的字串 wordwrap

    wordwrap

    打斷字符串為指定數量的字串
  • 計算字符串的soundex鍵 soundex

    soundex

    計算字符串的soundex鍵
  • 獲取字符串長度 strlen

    strlen

    獲取字符串長度
  • 使用“自然順序”算法進行字符串比較 strnatcmp

    strnatcmp

    使用“自然順序”算法進行字符串比較
  • rtrim的別名 chop

    chop

    rtrim的別名
  • 替換字符串的子串 substr_replace

    substr_replace

    替換字符串的子串
  • 將HTML實體轉換為相應的字符 html_entity_decode

    html_entity_decode

    將HTML實體轉換為相應的字符