downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

SplDoublyLinkedList::getIteratorMode> <SplDoublyLinkedList::count
[edit] Last updated: Fri, 25 May 2012

view this page in

SplDoublyLinkedList::current

(PHP 5 >= 5.3.0)

SplDoublyLinkedList::current現在の配列の要素を返す

説明

mixed SplDoublyLinkedList::current ( void )

双方向リンクリストの現在のノードを取得します。

パラメータ

この関数にはパラメータはありません。

返り値

現在のノードの値を返します。



add a note add a note User Contributed Notes SplDoublyLinkedList::current
rakesh dot mishra at gmail dot com 26-Jan-2011 11:18
<?php

/*
 * Examples of DoublyLinkedList
 */

$obj = new SplDoublyLinkedList();
// Check wither linked list is empty
if ($obj->isEmpty())
{
    echo
"Adding nodes to Linked List<br>";
   
$obj->push(2);
   
$obj->push(3);
    echo
"Adding the node at beginning of doubly linked list <br>";
   
$obj->unshift(10);
}

echo
"<br>Our Linked List:";
print_r($obj);

$curr = $obj->current(); // this will return NULL as we have not set initial node.

echo "<br> Rewinding the position so that current node points to first node ";
$obj->rewind();

echo
"<br>Current node of the linked list:";
echo 
$obj->current(); // this will print first node of the linked list.

echo "<br>Moving to Next node:";
$obj->next();

echo
"<br>Printing the next node:";
echo
$obj->current();

?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites