PHP 7.2.0 Beta 1 Released

SplDoublyLinkedList::valid

(PHP 5 >= 5.3.0, PHP 7)

SplDoublyLinkedList::validCheck whether the doubly linked list contains more nodes

Beschreibung

public bool SplDoublyLinkedList::valid ( void )

Checks if the doubly linked list contains any more nodes.

Parameter-Liste

Diese Funktion hat keine Parameter.

R├╝ckgabewerte

Returns TRUE if the doubly linked list contains any more nodes, FALSE otherwise.

add a note add a note

User Contributed Notes 1 note

up
0
lincoln dot du dot j at gmail dot com
15 days ago
$a = new SplDoublyLinkedList;
$arr=[1,2,3,4,5,6,7,8,9];

for($i=0;$i<count($arr);$i++){
    $a->add($i,$arr[$i]);
}

$a->rewind();

while($a->valid()){
    echo 'key ', $a->key(), ' value ', $a->current(),"\n";
    $a->next();
}
To Top