PHP - Fonction Ds \ Pair :: toArray ()

La fonction Ds \ Pair :: toArray () peut convertir une paire en tableau.

Syntaxe

public array Ds\Pair::toArray( void )

La fonction Ds \ Pair :: toArray () n'a aucun paramètre.

La fonction Ds \ Pair :: toArray () peut renvoyer un tableau contenant toutes les valeurs dans le même ordre que la paire.

Exemple 1

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

Exemple-2

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