PHP | ArrayIterator getFlags() Function
Last Updated :
21 Nov, 2019
Improve
The ArrayIterator::getFlags() function is an inbuilt function in PHP which is used to get the behavior of flags of array iterator.
Syntax:
php
php
int ArrayIterator::getFlags( void )Parameters: This function does not accept any parameters. Return Value: This function returns the behavior flags of the ArrayIterator. Below programs illustrate the ArrayIterator::getFlags() function in PHP: Program 1:
<?php
// Declare an ArrayIterator
$arrItr = new ArrayIterator(
array('G', 'e', 'e', 'k', 's', 'f', 'o', 'r')
);
// Get the flag
$flag = $arrItr->getFlags();
// Display the flag
var_dump($flag);
?>
Output:
Program 2:
int(0)
<?php
// Declare an ArrayIterator
$arrItr = new ArrayIterator(
array("Geeks", "for", "Geeks")
);
// Append the element into array
$arrItr->append("Computer");
$arrItr->append("Science");
$arrItr->append("Portal");
// Get the flag
$flag = $arrItr->getFlags();
// Display the flag value
var_dump($flag);
?>
Output:
Reference: https://www.php.net/manual/en/arrayiterator.getflags.php
int(0)