• PHP Video Tutorials

PHP - Ds Map reversed() Function


Advertisements

Ds\Map::reversed() function can return a reversed copy.

Syntax

public Ds\Map Ds\Map::reversed( void )

Ds\Map::reversed() function doesn't have any parameters.

Ds\Map::reversed() function can return a reversed copy of a map.

Example 1

<?php 
   $map = new \Ds\Map([1 => 10, 2 => 20, 3 => 30]); 
   
   print("The original map: \n"); 
   print_r($map); 
  
   $reversedMap = new \Ds\Map(); 
   $reversedMap = $map->reversed(); 
  
   print("\n The reversed copy of a map: \n"); 
   print_r($reversedMap); 
?>
php_function_reference.htm
Advertisements