PHP | Ds\Map remove() Function Last Updated : 30 Jul, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Map::remove() function is an inbuilt function in PHP which is used to remove and return a value by key. Syntax: mixed Ds\Map::remove( $key, $default ) Parameters: This function accepts two parameters as mentioned above and described below: $key: It holds the key value which need to remove. $default: It is optional parameter and it returns if key not found. Return Value: This function returns the value that was removed. Exception: This function throws OutOfRangeException if the key not exist and value of $default is not provided. Below programs illustrate the Ds\Map::remove() function in PHP: Example 1: php <?php // Declare new Map $map = new \Ds\Map([ 1 => "geeks", 2 => "for", 3 => "geeks", 4 => "DataStructures" ]); echo("Map Elements\n"); // Display the map elements print_r($map); echo("\nRemoved element of the map: \n"); // Use remove() function to remove // value at index 3 and return it var_dump($map->remove(3)); ?> Output: Map Elements Ds\Map Object ( [0] => Ds\Pair Object ( [key] => 1 [value] => geeks ) [1] => Ds\Pair Object ( [key] => 2 [value] => for ) [2] => Ds\Pair Object ( [key] => 3 [value] => geeks ) [3] => Ds\Pair Object ( [key] => 4 [value] => DataStructures ) ) Removed element of the map: string(5) "geeks" Example: php <?php // Declare new Map $map = new \Ds\Map([ "a" => "geeks", "b" => "for", "c" => "geeks", "d" => "DataStructures" ]); echo("Map Elements\n"); // Display the map elements print_r($map); echo("\nRemoved element of the map: \n"); // Use remove() function to remove // value at index 3 and return it var_dump($map->remove("c")); ?> Output: Map Elements Ds\Map Object ( [0] => Ds\Pair Object ( [key] => a [value] => geeks ) [1] => Ds\Pair Object ( [key] => b [value] => for ) [2] => Ds\Pair Object ( [key] => c [value] => geeks ) [3] => Ds\Pair Object ( [key] => d [value] => DataStructures ) ) Removed element of the map: string(5) "geeks" Reference: https://www.php.net/manual/en/ds-map.remove.php Comment More infoAdvertise with us Next Article PHP DsSet remove() Function jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_map Similar Reads PHP | DsMap remove() Function The Ds\Map::remove() function is an inbuilt function in PHP which is used to remove and return a value by key. Syntax: mixed Ds\Map::remove( $key, $default ) Parameters: This function accepts two parameters as mentioned above and described below: $key: It holds the key value which need to remove. $d 2 min read PHP DsSet remove() Function The Ds\Set::remove() function of Ds\Set class in PHP is an inbuilt function which is used to remove specific values from a Set instance. This function can remove both single or multiple values from a Set. Syntax: void public Ds\Set::remove ([ mixed $...values ] ) Parameter: This function accepts the 2 min read PHP | DsDeque remove() Function The Ds\Deque::remove() function is an inbuilt function in PHP which is used to remove and return the index value. Syntax: public Ds\Deque::remove( $index ) : mixed Parameters: This function accepts single parameter $index which holds the index of Deque for which the element is to be returned and rem 2 min read PHP | DsVector remove() Function The Ds\Vector::remove() function is an inbuilt function in PHP that is used to remove an element from the Vector at the specified ï¼index argument and returns the removed element. Syntax: mixed public Ds\Vector::remove( $index ) Â Parameters: This function does not accept any parameter. Â Return Value: 1 min read PHP | DsSequence remove() Function The Ds\Sequence::remove() function is an inbuilt function in PHP which is used to remove and return a value by index. Syntax: mixed abstract public Ds\Sequence::remove ( int $index ) Parameters: This function accepts a single parameter $index which holds the index of value to remove. Return value: T 1 min read D3.js | d3.map.remove() Function The map.remove() function is an inbuilt function in D3.js. If the created map contains the given key string then it removes the entry and returns true. If key string not presents then it returns false. Syntax: map.remove(key) Parameters: This function accepts single parameter key which is used to sp 2 min read PHP | DsMap reverse() Function The Ds/Map::reverse() function in PHP is used to in-place reverse the elements of a specified Map instance. That is, the function in-place reverses the order of elements present in the specified Map instance. Syntax: Ds\Map public Ds\Map::reverse ( int $position ) Parameter: This function does not a 2 min read PHP | DsDeque map() Function The Ds\Deque::map() function is an inbuilt function in PHP which is used to return the Deque with each element modified on the basis of operation performed as per the callback function. Syntax: public Ds\Deque::map( $callback ) : Ds\Deque Parameters: This function accepts single parameter $callback 2 min read PHP | Imagick removeImage() Function The Imagick::removeImage() function is an inbuilt function in PHP which is used to remove an image from the image list. This function removes the current image which is pointed by the cursor. Syntax: bool Imagick::removeImage( void ) Parameters: This function doesnât accepts any parameters. Return V 1 min read PHP | DsVector map() Function The Ds\Vector::map() function is an inbuilt function in PHP which is used to return the result of a callback after applying to each value in the vector. Syntax: Ds\Vector public Ds\Vector::map( $callback ) Parameters: This function accepts single parameter $callback which is to be applied to each ve 2 min read Like