PHP | Ds\Pair clear() Function
The Ds\Pair::clear() function is an inbuilt function in PHP which is used to remove all values from the pair.
Syntax:
void Ds\Pair::clear( void )
Parameters: This function does not accept any parameters.
Return Value: This function does not return any value.
Below programs illustrate the Ds\Pair::clear() function in PHP:
Program:
<?php // Create new pair $pair = new \Ds\Pair("G", "GeeksforGeeks"); echo ("Original pair elements:\n"); // Display the pair elements print_r($pair); echo("Modified pair\n"); // Use clear() function to // remove pair elements $pair->clear(); // Display pair elements print_r($pair); ?> |
chevron_right
filter_none
Output:
Original pair elements:
Ds\Pair Object
(
[key] => G
[value] => GeeksforGeeks
)
Modified pair
Ds\Pair Object
(
)
Reference: https://www.php.net/manual/en/ds-pair.clear.php
Recommended Posts:
- PHP | Ds\Set clear() Function
- PHP | DS\Map clear() Function
- p5.js | clear() function
- D3.js | d3.set.clear() Function
- D3.js | d3.map.clear() Function
- PHP Ds\Queue clear() Function
- PHP | Ds\Vector clear() Function
- PHP | Ds\Collection clear() Function
- PHP | Ds\Deque clear() Function
- PHP | Ds\Stack clear() Function
- PHP | Gmagick clear() Function
- PHP Ds\PriorityQueue clear() Function
- PHP | Imagick clear() Function
- CSS | clear Property
- What does the CSS rule “clear: both” do?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



