数据结构
在线手册:中文  英文

The SplDoublyLinkedList class

(PHP 5 >= 5.3.0)

简介

The SplDoublyLinkedList class provides the main functionalities of a doubly linked list.

类摘要

SplDoublyLinkedList implements Iterator , ArrayAccess , Countable {
/* 方法 */
public __construct ( void )
public mixed bottom ( void )
public int count ( void )
public mixed current ( void )
public int getIteratorMode ( void )
public bool isEmpty ( void )
public mixed key ( void )
public void next ( void )
public bool offsetExists ( mixed $index )
public mixed offsetGet ( mixed $index )
public void offsetSet ( mixed $index , mixed $newval )
public void offsetUnset ( mixed $index )
public mixed pop ( void )
public void prev ( void )
public void push ( mixed $value )
public void rewind ( void )
public string serialize ( void )
public void setIteratorMode ( int $mode )
public mixed shift ( void )
public mixed top ( void )
public void unserialize ( string $serialized )
public void unshift ( mixed $value )
public bool valid ( void )
}

Table of Contents


数据结构
在线手册:中文  英文

用户评论:

rakesh dot mishra at gmail dot com (2011-01-25 05:17:29)

Here is simple examples of SplQueue: -
<?php
echo "Create Object of Spl. Queue:";
$obj = new SplQueue();

echo 
"<br>Check for Queue is Empty:";
if(
$obj->isEmpty())
{
    
$obj->enqueue("Simple");
    
$obj->enqueue("Example");
    
$obj->enqueue("Of");
    
$obj->enqueue("PHP");
}

echo 
"<br>View queue:";
print_r($obj);

if(! 
$obj->offsetExists(4))
{
    
$obj->enqueue(10);
}

print_r($obj);

echo 
"<br>Get the value of the offset at 3 ";
if(
$obj->offsetGet(3))
{
    echo 
$obj->offsetGet(3);
    
    echo 
"<br>Resetting the value of a node:";
    
$obj->offsetSet(4,6);
}
?>

易百教程