运行 ❯
获取您
自己的 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 )