執行 ❯
獲取您
自己的 PHP
伺服器
×
更改方向
更改主題,深色/淺色
前往 Spaces
<!DOCTYPE html> <html> <body> <p>Mode 1 will return an array with the ASCII value as key and how many times it occurred as value (e.g. in this example, the ASCII value for the letter "l" is 108, and it occurs three times. The ASCII value for "space" is 32):</p> <?php $str = "Hello World!"; print_r(count_chars($str,1)); ?> </body> </html>
模式 1 將返回一個數組,其中 ASCII 值作為鍵,出現次數作為值(例如,在這個示例中,“l”字母的 ASCII 值是 108,它出現了三次。“空格”的 ASCII 值是 32)
陣列 ( [32] => 1 [33] => 1 [72] => 1 [87] => 1 [100] => 1 [101] => 1 [108] => 3 [111] => 2 [114] => 1 )