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

search for in the

SplStack::__construct> <SplDoublyLinkedList::valid
[edit] Last updated: Fri, 24 Jun 2011

view this page in

The SplStack class

Introduction

کلاس SplStack عملکرد اصلی پشته را با استفاده از لیست دو پیوندی پیاده می‌کند.

Class synopsis

SplStack extends SplDoublyLinkedList implements Iterator , ArrayAccess , Countable {
/* Methods */
__construct ( void )
void setIteratorMode ( int $mode )
/* Inherited methods */
mixed SplDoublyLinkedList::key ( void )
void SplDoublyLinkedList::offsetSet ( mixed $index , mixed $newval )
mixed SplDoublyLinkedList::pop ( void )
mixed SplDoublyLinkedList::top ( void )
}

Table of Contents



add a note add a note User Contributed Notes SplStack - [1 notes]
up
1
Sandro Alves Peres
7 days ago
<?php
# Think of the stack as an array reversed, where the last element has index zero

$stack = new SplStack();
$stack->push('a');
$stack->push('b');
$stack->push('c');

$stack->offsetSet(0, 'C'); # the last element has index zero

$stack->rewind();

while(
$stack->valid() )
{
    echo
$stack->current(), PHP_EOL;
   
$stack->next();
}

/*

OUTPUT
****************************

C
b
a

*/
?>

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