\PtypesStack

Stack is a last in first out (lifo) data type.

functions: push, pop, is_empty, size, peek

Summary

Methods
Properties
Constants
__construct()
push()
pop()
is_empty()
size()
peek()
count()
__toString()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
$maxsize
$items
$top
N/A

Properties

$maxsize

$maxsize : 

Type

$items

$items : 

Type

$top

$top : 

Type

Methods

__construct()

__construct(integer  $maxsize) : \Ptypes\Stack

Stack is a last in first out (lifo) data type.

Parameters

integer $maxsize

Returns

\Ptypes\Stack

push()

push(object  $item) 

Push (add) the item to the Stack.

Parameters

object $item

pop()

pop() 

Pop (remove) the top item from the Stack.

is_empty()

is_empty() : boolean

is_empty tests whether the stack is empty.

Returns

boolean

size()

size() : integer

Size, returns the size of the stack.

Returns

integer

peek()

peek() : object

Peek returns the top element of the stack, returns null if the stack is empty.

Returns

object

count()

count() : integer

Count, same functionality as Size.

Overrides the default count function call on this class.

Returns

integer

__toString()

__toString() : string

Overrides the default toString call on this class.

Returns

string