Posts Tagged ‘Length of arry in php’

count() in php

Saturday, November 8, 2008 11:29 No Comments

The count() function is useful when you want to return how many elements are in your array. You can then use this in a for loop. Here’s an example we used earlier, only this time with the count function: $a[0]  = 2; $a[5]  = 3; $a[10] = 6; $totalsize = count($a); for($i=o;$i< $totalsize;$i++){ echo $totalsize[$i]; }

This was posted under category: PHP, Programming Tags: , ,