The SplFixedArray::count() function is an inbuilt function in PHP which is used to return the size of the array.
Syntax:
int SplFixedArray::count()
Parameters: This function does not accept any parameter.
Return Value: This function returns the size of the array.
Below programs illustrate the SplFixedArray::count() function in PHP:
Program 1:
<?php
$array = new SplFixedArray(10);
echo $array -> count ();
?>
|
Program 2:
<?php
$gfg = new SplFixedArray(8);
$gfg1 = new SplFixedArray(7);
$gfg2 = new SplFixedArray(9);
$gfg3 = new SplFixedArray(100);
$gfg4 = new SplFixedArray(878);
$gfg5 = new SplFixedArray(0);
echo $gfg1 -> count (). "\n" ;
echo $gfg2 -> count (). "\n" ;
echo $gfg3 -> count (). "\n" ;
echo $gfg4 -> count (). "\n" ;
echo count ( $gfg5 ) . "\n" ;
echo count ( $gfg ) . "\n" ;
?>
|
Reference: https://www.php.net/manual/en/splfixedarray.count.php
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!
Last Updated :
23 Jun, 2023
Like Article
Save Article