PHP SplFixedArray count() Function Last Updated : 23 Jun, 2023 Comments Improve Suggest changes Like Article Like Report 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 <?php // Create an array of fixed size 10 $array = new SplFixedArray(10); // Print size of the array echo $array->count(); ?> Output: 10 Program 2: php <?php // Creating fixed size array $gfg = new SplFixedArray(8); $gfg1 = new SplFixedArray(7); $gfg2 = new SplFixedArray(9); $gfg3 = new SplFixedArray(100); $gfg4 = new SplFixedArray(878); $gfg5 = new SplFixedArray(0); // Print size of the array echo $gfg1->count(). "\n"; echo $gfg2->count(). "\n"; echo $gfg3->count(). "\n"; echo $gfg4->count(). "\n"; // Count function can be used // via passing parameters echo count($gfg5) . "\n"; echo count($gfg) . "\n"; ?> Output: 7 9 100 878 0 8 Reference: https://www.php.net/manual/en/splfixedarray.count.php Comment More infoAdvertise with us Next Article PHP SplFixedArray count() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplFixedArray current() Function The SplFixedArray::current() function is an inbuilt function in PHP which is used to get the current entry of the array. Syntax: mixed SplFixedArray::current() Parameters: This function does not accept any parameter. Return Value: This function returns the current entry of the array. Below programs 1 min read PHP | SplFixedArray __construct() Function The SplFixedArray::__construct() function is an inbuilt function in PHP which is used to construct a new fixed size array. Syntax: void SplFixedArray::__construct( $size ) Parameters: This function accepts single parameter $size which specifies the size of an array. Return Value: This function does 1 min read PHP SplFixedArray key() Function The SplFixedArray::key() function is an inbuilt function in PHP which is used to get the key of the current index of the array. Syntax: int SplFixedArray::key() Parameters: This function does not accept any parameter. Return Value: This function returns the key of the current index of the array. Bel 1 min read PHP | SplHeap count() Function The SplHeap::count() function is an inbuilt function in PHP which is used to count the elements in the heap. Generally, Heap can be of two types: Max-Heap: In a Max-Heap the key present at the root node must be greatest among the keys present at all of its children. The same property must be recursi 2 min read PHP SplFixedArray valid() Function The SplFixedArray::valid() function is an inbuilt function in PHP which is used to check the array can contain more elements or not. Syntax: bool SplFixedArray::valid() Parameters: This function does not accept any parameter. Return Value: This function returns true on success, false otherwise. Belo 1 min read PHP SplFixedArray rewind() Function The SplFixedArray::rewind() function is an inbuilt function in PHP which is used to rewind the array iterator to start position. Syntax: void SplFixedArray::rewind() Parameters: This function does not accept any parameter. Return Value: This function does not return any value. Below programs illustr 1 min read PHP SplFixedArray getSize() Function The SplFixedArray::getSize() function is an inbuilt function in PHP which is used to get the size of the array. Syntax: int SplFixedArray::getSize() Parameters: This function does not accept any parameter. Return Value: This function returns the size of the array. Below programs illustrate the SplFi 1 min read PHP SplFixedArray setSize() Function The SplFixedArray::setSize() function is an inbuilt function in PHP which is used to set the size of the array. Syntax: bool SplFixedArray::setSize( $size ) Parameters: This function accepts a single parameter $size which specifies the size of the array. Return Value: This function returns true on s 1 min read PHP SplFixedArray toArray() Function The SplFixedArray::toArray() function is an inbuilt function in PHP which is used to get a PHP array from the fixed array. Syntax: array SplFixedArray::toArray() Parameters: This function does not accept any parameter. Return Value: This function returns a PHP array. Below programs illustrate the Sp 1 min read PHP SplFixedArray offsetGet() Function The SplFixedArray::offsetGet() function is an inbuilt function in PHP that is used to get the offset of the specified index in an array. Syntax: mixed SplFixedArray::offsetGet( $index ) Parameters: This function accepts a single parameter $index which specifies the requested offset. Return Value: Th 1 min read Like