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 SplFixedArray::getSize() function in PHP:
Program 1:
<?php // Create a fixed array $gfg = new SplFixedArray(15); // Print Size of the array echo $gfg->getSize(); ?> |
15
Program 2:
<?php // Create some fixed size array $gfg1 = new SplFixedArray(0); $gfg2 = new SplFixedArray(9); $gfg3 = new SplFixedArray(100); $gfg4 = new SplFixedArray(878); // Print Size of the array echo $gfg1->getSize() . "\n"; echo $gfg2->getSize() . "\n"; echo $gfg3->getSize() . "\n"; echo $gfg4->getSize() . "\n"; // Set array size $gfg1->setSize(100); $gfg2->setSize(200); // Print size after set echo $gfg1->getSize() . "\n"; echo $gfg2->getSize() . "\n"; ?> |
0 9 100 878 100 200
Reference:https://www.php.net/manual/en/splfixedarray.getsize.php
Recommended Posts:
- PHP | SplFileInfo getSize( ) Function
- PHP | Gmagick getsize() Function
- PHP | Imagick getSize() Function
- PHP | DirectoryIterator getSize() Function
- PHP | SplFixedArray count() Function
- PHP | SplFixedArray current() Function
- PHP | SplFixedArray __construct() Function
- PHP | SplFixedArray next() Function
- PHP | SplFixedArray key() Function
- PHP | SplFixedArray valid() Function
- PHP | SplFixedArray toArray() Function
- PHP | SplFixedArray setSize() Function
- PHP | SplFixedArray rewind() Function
- PHP | SplFixedArray offsetUnset () Function
- PHP | SplFixedArray offsetGet() Function
- PHP | SplFixedArray offsetExists() Function
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

