+

PHP ArrayObject getFlags () function

Syntax:
int ArrayObject::getFlags (void)
Parameters:This function takes no parameters.Return value:This function returns the behavior flags of the ArrayObject.The following programs illustrate the function ArrayObject::getFlags() in PHP:Program 1:
// PHP illustration program
// ArrayObject::getFlags() function 
// Declare an array and convert it to
// array of objects $arrObject = new ArrayObje ct ( array ( `Geeks` , ` for` , ` Geeks` ) );  
// Using the ArrayObject::getFlags() function
// to find out the behavior of the flags $flag = $arrObject -> getFlags(); var_dump ( $flag );  
// Set new flags $arrObject -> setFlags (ArrayObject::ARRAY_AS_PROPS);  
// Using the ArrayObject::getFlags() function
// to find out the behavior of the flags $flag = $arrObject -> getFlags(); var_dump ( $flag );  
?>
Exit:
int (0 ) int (2)
Program 2:
// PHP illustration program
// ArrayObject::getFlags() function 
// Declare an associative array $arr = array ( "a" = > "Welcome" , " b " = > " to " , " c " = > "GeeksforGeeks");  
// Create array object $arrObject = new ArrayObject ( $arr );  
// Using the ArrayObject::getFlags() function
// to find out the behavior of the flags $flag = $arrObject -> getFlags(); var_dump ( $flag );  
// Set new flags $arrObject -> setFlags (ArrayObject::STD_PROP_LIST);  
// Using the ArrayObject::getFlags() function
// to find out the behavior of the flags $flag = $arrObject -> getFlags(); var_dump ( $flag );  
?>
Exit:
int (0 ) int (1)
Link: https:// www .php.net / manual / en / arrayobject.getflags.php
Get Solution for free from DataCamp guru