PHP SplFixedArray rewind() Function Last Updated : 23 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 illustrate the SplFixedArray::rewind() function in PHP: Program 1: php <?php // Create a fixed size array $gfg = new SplFixedArray(6); $gfg[0] = 1; $gfg[1] = 5; $gfg[2] = 10; // Move to next index $gfg->next(); $gfg->next(); // Print result before rewind echo $gfg->current(). "\n"; // Using rewind function $gfg->rewind(); // Print result after rewind echo $gfg->current(). "\n"; ?> Output: 10 1 Program 2: php <?php // Create some fixed size array $gfg = new SplFixedArray(6); $gfg[0] = 1; $gfg[1] = 5; $gfg[2] = 1; $gfg[3] = 11; $gfg[4] = 15; $gfg[5] = 17; $i = 0; // Iterate array and print values while($i < 6) { // Using rewind function // it will rewind each time at initial index $gfg->rewind(); // Print current value of index of the array echo $gfg->current(). "\n"; // Move next each time of iteration $gfg->next(); $i++; } ?> Output: 1 1 1 1 1 1 Reference: https://www.php.net/manual/en/splfixedarray.rewind.php Comment More infoAdvertise with us Next Article PHP SplFixedArray valid() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplHeap rewind() Function The SplHeap::rewind() function is an inbuilt function in PHP that is used to rewind the iterator to the beginning. 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 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 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 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 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 Like