• PHP Video Tutorials

PHP - Ds\Pair::toArray() Function



Ds\Pair::toArray() function can convert a pair to an array.

Syntax

public array Ds\Pair::toArray( void )

Ds\Pair::toArray() function doesn't have any parameters.

Ds\Pair::toArray() function can return an array containing all values in the same order as the pair.

Example-1

<?php  
   $pair = new \Ds\Pair([1, 2], ["TutorialsPoint", "India"]);  
  
   echo "The array is: \n";  
   var_dump($pair->toArray());  
?>

Example-2

<?php  
   $pair = new \Ds\Pair("x", "TutorialsPoint");  
   
   echo "The array is: \n";  
   print_r($pair->toArray());  
?> 
php_function_reference.htm
Advertisements