<?PHP $arr=array(1,2,3,4,5,6,7,8,9); $len=count($arr); echo "$len"; //result is 9 $arr = array("one"=>"Monday","two"=>"Tuesday","three"=>"Wednesday", "four"=>"Thursday","five"=>"Friday","six"=>"Saturday","seven"=>"Sunday"); echo count($arr); //result is 7 ?>
<?PHP $arr=array(1,2,3,4,5,6,7,8,9); for ($ii=0;$ii<count($arr);$ii++) { echo "$ii, $arr[$ii]\n"; } /* 0, 1 1, 2 2, 3 3, 4 4, 5 5, 6 6, 7 7, 8 8, 9 */ ?>
<?PHP $str = "This is a string."; echo strlen($str); //result is 17 ?>