PHP SplFixedArray valid() Function Last Updated : 23 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Below programs illustrate the SplFixedArray::valid() function in PHP: Program 1: php <?php // Create a fixed size array $gfg = new SplFixedArray(3); // Move to two step forward $gfg->next(); $gfg->next(); // Print result var_dump($gfg->valid()); $gfg->next(); // Print result var_dump($gfg->valid()); $gfg->next(); // Print result var_dump($gfg->valid()); ?> Output: bool(true) bool(false) bool(false) Program 2: php <?php // Create some fixed size array $gfg = new SplFixedArray(6); $gfg[0] = 1; $gfg[1] = 5; $gfg[2] = 1; $gfg[4] = 15; $gfg[5] = 22; // Iterate array and print values while($gfg->valid()) { // Print current value of index of the array var_dump($gfg->valid()); // Move next each time of iteration $gfg->next(); } ?> Output: bool(true) bool(true) bool(true) bool(true) bool(true) bool(true) Reference: https://www.php.net/manual/en/splfixedarray.valid.php Comment More infoAdvertise with us Next Article PHP | SplDoublyLinkedList valid() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplHeap valid() Function The SplHeap::valid() function is an inbuilt function in PHP which is used to check whether the heap contains more nodes. 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 s 2 min read PHP | SimpleXMLIterator valid() Function The SimpleXMLIterator::valid() function is an inbuilt function in PHP which is used to check the current element is valid or not. Syntax: bool SimpleXMLIterator::valid( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE if the current element is 1 min read PHP SplObjectStorage valid() Function The SplObjectStorage::valid() function is an inbuilt function in PHP which is used to check the current storage entry is valid or not. Syntax: bool SplObjectStorage::valid() Parameters: This function does not accept any parameter. Return Value: This function returns true if the iterator entry is val 1 min read PHP SplFixedArray offsetExists() Function The SplFixedArray::offsetExists() function is an inbuilt function in PHP which is used to check provided index exist or not in an array. Syntax: bool SplFixedArray::offsetExists( $index ) Parameters: This function accepts single parameter $index which specifies the requested index. Return Value: Thi 1 min read PHP | SplDoublyLinkedList valid() Function The SplDoublyLinkedList::valid() function is an inbuilt function in PHP which is used to check whether the doubly linked list contains more nodes or not. Syntax: bool SplDoublyLinkedList::valid( void ) Parameters: This function does not accept any parameters. Return Value: This function returns TRUE 1 min read PHP | SplFileInfo isDir() Function The SplFileInfo::isDir() function is an inbuilt function of Standard PHP Library (SPL) in PHP which is used to check the file is a directory or not. Syntax: bool SplFileInfo::isDir( void ) Parameters: This function does not accept any parameter. Return values: This function returns true if file is a 1 min read Like