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