PHP SplFixedArray toArray() Function Last Updated : 23 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 SplFixedArray::toArray() function in PHP: Program 1: php <?php // Create a fixed size array $gfg = new SplFixedArray(3); $gfg[0] = 1; $gfg[1] = 5; $gfg[2] = 10; var_dump($gfg->toArray()); ?> Output: array(3) { [0]=> int(1) [1]=> int(5) [2]=> int(10) } Program 2: php <?php // Create some fixed size array $gfg = new SplFixedArray(3); $gfg1 = new SplFixedArray(6); $gfg1[0] = 1; $gfg1[1] = 5; $gfg1[2] = 10; $gfg2 = new SplFixedArray(5); $gfg2[0] = 1; $gfg2[1] = 5; $gfg2[2] = 10; $gfg2[3] = 10; $gfg2[4] = 20; // Print result var_dump($gfg->toArray()); var_dump($gfg1->toArray()); var_dump($gfg2->toArray()); ?> Output: array(3) { [0]=> NULL [1]=> NULL [2]=> NULL } array(6) { [0]=> int(1) [1]=> int(5) [2]=> int(10) [3]=> NULL [4]=> NULL [5]=> NULL } array(5) { [0]=> int(1) [1]=> int(5) [2]=> int(10) [3]=> int(10) [4]=> int(20) } Reference: https://www.php.net/manual/en/splfixedarray.toarray.php Comment More infoAdvertise with us Next Article PHP SplFixedArray rewind() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 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 SplFixedArray next() Function The SplFixedArray::next() function is an inbuilt function in PHP which is used to move the array element to the next entry of the array. Syntax: void SplFixedArray::next() Parameters: This function does not accept any parameter. Return Value: This function does not return any value. Below programs i 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 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 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 Like