size
 
 
 

Returns the number of elements in an array or the number of characters in a string.

int size(array array)

int size(string string)

array is the name of the array whose size you want.

string is the string whose number of characters you want.

Example 1

string $s = "Hello";
$stringlen = size($s);

The size($s) function returns 5, then the statement assigns 5 to $stringlen.

Example 2

int $myInts[] = {1,2,3,4,5,6};
$numInts = size($myInts);

The size($myInts) function returns 6, then the statement assigns 6 to $numInts.