PHP SplFixedArray setSize() Function Last Updated : 23 Jun, 2023 Comments Improve Suggest changes Like Article Like Report 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 success, false otherwise. Below programs illustrate the SplFixedArray::setSize() function in PHP: Program 1: php <?php // Create fixed size array $gfg = new SplFixedArray(50); // Print size before set echo $gfg->getSize() . "\n"; // Set size of array $gfg->setSize(110); // Print result after set the size echo $gfg->getSize() . "\n"; ?> Output: 50 110 Program 2: php <?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"; ?> Output: 0 9 100 878 100 200 Reference: https://www.php.net/manual/en/splfixedarray.setsize.php Comment More infoAdvertise with us Next Article PHP SplFixedArray setSize() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 count() Function 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 SplFix 1 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 offsetUnset () Function The SplFixedArray::offsetUnset() function is an inbuilt function in PHP which is used to unset the value of the requested index. Syntax: void SplFixedArray::offsetUnset( $index ) Parameters: This function accepts a single parameter $index which specifies the required index whose values need to unset 1 min read Like