PHP Ds Deque get() 函数

PHP Ds Deque get() 函数

Ds\Deque::get() 函数可以返回给定索引处的值。

语法

public mixed Ds\Deque::get( int $index )

Ds\Deque::get()函数可以返回请求索引的值。如果索引无效,该函数可能会引发OutOfRangeException异常。

示例1

<?php 
   deque = new \Ds\Deque([10, 20, 5, 40, 50, 8]);   echo("The elements in the deque: \n");   print_r(deque); 

   echo("\n The element at index 3 in the deque:"); 
   var_dump($deque->get(3)); 
?>

示例2

<?php 
   deque = new \Ds\Deque(["Tutorials", "Point", "India", "Tutorix"]);   echo("The elements in the deque \n");   print_r(deque); 

   echo("\n The element at index 1 in the deque:"); 
   var_dump($deque->get(1)); 
?>

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程