douyin8813 2016-10-06 11:40
浏览 60

PHP中的count_chars,其中字符数大于16

So for some reason when I use count_chars(11111111111111111111,3) I get back something to the effect of .1111111111111119

Is there a different way to count the occurences of each character in a string?

Here's some example code

            $value = 11111111111111111111; 
            $value = strval($value);
            $count = count_chars($value,3);
            print_r($count);

If I print out the result I get +.012E

  • 写回答

2条回答 默认 最新

  • duandi8838 2016-10-06 11:42
    关注

    If you want to count characters in string, give a string...

    count_chars('11111111111111111111',3)
    

    ps: and if you really want to count characters use mode 1

     $res = count_chars('1111111111111111111122333', 1);
    
     foreach ($res as $char => $number) {
      echo chr($char). ' ' . $number .'<br />';
     }
    
    评论

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效