• PHP Video Tutorials

PHP - Ds Map put() Function



Ds\Map::put() function can associate a key with a value.

Syntax

public void Ds\Map::put( mixed $key , mixed $value )

Ds\Map::put() function can associate a key with a value, overwriting the previous association if one exists.

Ds\Map::put() function doesn't return any value.

Example 1

<?php  
   $map = new \Ds\Map(); 
   $map->put("x", "Tutorials"); 
   $map->put("y", "Point"); 
   $map->put("z", "India"); 
     
   print_r($map); 
  
   $map = new \Ds\Map(); 
   $map->put("x", "Tutorix");  
   $map->put("y", "India"); 
   $map->put("z", "Hyd"); 
  
   print_r($map); 
?> 
php_function_reference.htm
Advertisements