PHP | SplFixedArray __construct() Function Last Updated : 03 Oct, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 not return any value. Below programs illustrate the SplFixedArray::__construct() function in PHP: Program 1: php <?php // Create new fixed array of size 2 $gfg = new SplFixedArray(2); $gfg[1] = "GeeksforGeeks"; // Print Result var_dump($gfg[0]); var_dump($gfg[1]); ?> Output: NULL string(13) "GeeksforGeeks" Program 2: php <?php // Create new fixed array of size 8 $gfg = new SplFixedArray(8); $gfg[2] = 5; $gfg[4] = "gfg"; $gfg[5] = "Geeks"; $gfg[7] = "GeeksforGeeks"; // Iterate array and print its values foreach( $gfg as $i ) { var_dump($i); } ?> Output: NULL NULL int(5) NULL string(3) "gfg" string(5) "Geeks" NULL string(13) "GeeksforGeeks" Reference: https://www.php.net/manual/en/splfixedarray.construct.php Comment More infoAdvertise with us Next Article PHP SplFixedArray current() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads 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 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 SplHeap __construct() Function The SplHeap::__construct() function is an inbuilt function in PHP that is used to create the heap data structure. Generally, the Heap Data Structure are 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 pr 2 min read PHP SplQueue::__construct() Function The SplQueue::__construct() function is an inbuilt function in PHP which is used to construct a queue which is implemented using a doubly-linked list. Syntax: void SplQueue::__construct(void) Parameters: This function does not accept any parameter. Return Value: This function does not return any val 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 Like