Blogger Information
Blog 250
fans 3
comment 0
visits 321852
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
函数:count()的用法
梁凯达的博客
Original
1707 people have browsed it

<?php
 //count()
 //函数用于统计数组元素总数
 //第一个参数为要统计的数组或者对象
 //第二个参数为可选参数 true或false
 //true  表示统计包含递归(二维数组)的个数
 //false 代表不递归统计个数  默认值
 //返回值 统计出来的个数
 

实例

 
 $arr= array(
  1,
  2,
  3=>array(
    4,
    5,
    6,
    7=>array(
     8,
     9,
     10,
     ),
    11,
   ),
  12,
  13
  );
 var_dump($arr);
 //false  不递归统计元素个数 默认值的情况下
 echo count($arr);
 //true  是递归统计里面的元素个数
 echo count($arr,true);

运行实例 »

点击 "运行实例" 按钮查看在线实例

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post