+

PHP Ds / Vector isEmpty () function

Syntax:
bool public DsVector::isEmpty (void)
Parameters: this function takes no parameters.Return value:this function returns true if the vector is empty, otherwise - false.The following programs illustrate the Ds / Vector::isEmpty()function in PHP:Program 1:  
// Create a new vector $vector = new DsVector ([1, 2, 4, 5]);  
// Use the isEmpty() function for
// check the vector var_dump ( $vector -> isEmpty());  
// Use the clear() function to remove
// vector elements $vector -> clear();  
// Use the isEmpty() function var_dump ( $vector -> isEmpty());  
?>
Output:
bool (false) bool (true)
Program 2:  
// Create a new vector $vector = new DsVector ([ "engineer" , "for" , "engineer" ]);  
// Use the isEmpty() function for
// check the vector var_dump ( $vector -> isEmpty());  
// Use the clear() function to remove
// vector elements $vector -> clear();  
// Use the isEmpty() function var_dump ( $vector -> isEmpty());  
?>
Output:
bool (false) bool (true)
Link: http://php.net/manual/en/ds-vector.isempty.php
Get Solution for free from DataCamp guru