Syntax:void SplDoublyLinkedList::next (void)
Parameters:this function does not take any parameters.
Returned value:does not return any value.The programs below illustrate the
function SplDoublyLinkedList::next() in PHP:
Program 1:
// Declare an empty SplDoublyLinkedList
$list
=
new
SplDoublyLinkedList;
// Use the SplDoublyLinkedList::add() function for
// add elements to SplDoublyLinkedList
$list
-> add (0, 30);
$list
-> add (1, 20);
$list
-> add (2, 30);
$list
-> add (3,
" Geeks "
);
$list
-> add (4,
’ G’
);
$list
->
rewind
();
// Use the SplDoublyLinkedList::current() function
// to get the current element
var_dump (
$list
-> current());
// Use the next() function to enlarge
// index value
$list
-> next();
// Use the SplDoublyLinkedList::current() function
// to get the current element
var_dump (
$list
-> current());
?>
Exit:int (30 ) int (20)
Program 2:
// Declare an empty SplDoublyLinkedList
$list
=
new
SplDoublyLinkedList();
// Use the SplDoublyLinkedList::push() function for
// add elements to SplDoublyLinkedList
$list
-> push (1);
$list
-> push (2);
$list
-> push (3);
$list
-> push (8);
$list
-> push (5);
$list
->
rewind
();
// Use the SplDoublyLinkedList::current() function
// to get the current element
var_dump (
$list
-> current());
// Use the next() function to enlarge
// index value
$list
-> next();
$list
-> next();
$list
-> next();
// Use the SplDoublyLinkedList::current() function
// to get the current element
var_dump (
$list
-> current());
?>
Exit:int (1 ) int (8)
Link: https://www .php.net / manual / en / spldoublylinkedlist.next.php