• PHP Video Tutorials

PHP - Ds\Pair::__construct() Function



Ds\Pair::__construct() function can create a new instance.

Syntax

public Ds\Pair::__construct([ mixed $key [, mixed $value ]] )

Ds\Pair::__construct() function can create a new instance by using a given key and value.

Example-1

<?php  
   $pair = new \Ds\pair(["x", "y", "z"], ["10", "20", "30"]); 
   
   var_dump($pair);  
?>

Example-2

<?php  
   $pair = new \Ds\Pair();  
   print_r($pair);  
    
   $pair = new \Ds\pair(["1", "2", "3"], ["Tutorials", "Point", "India"]); 
   print_r($pair);  
?>
php_function_reference.htm
Advertisements