-
-
Notifications
You must be signed in to change notification settings - Fork 1
SplArrayQueue
teguhrianto22 edited this page Oct 3, 2016
·
5 revisions
The SplStack class provides the main functionalities of a stack implemented using a doubly linked list and the iterator mode is based on FIFO (First In First Out).
O2System\Spl\DatastructuresO2System\Spl\Datastructures\SplArrayQueueuse O2System\Spl\Datastructures\SplArrayQueue;
$vehicles = new SplArrayQueue();
$vehicles->push( 'Ferrari' );O2System\Spl\Datastructures\SplArrayQueue class constructor.
| Parameter | type | Requirement | Description |
|---|---|---|---|
$queue |
array |
optional | initial array |
| Type | Description |
|---|---|
SplArrayQueue |
Returns an SplArrayQueue object on success. |
$vehicles = new SplArrayQueue ( [
'Ferrari',
'Porsche'
] );Checks if the array storage is empty.
| Type | Description |
|---|---|
bool |
Returns TRUE if the array storage is empty. |
if( $vehicles->isEmpty() )
{
// if the array storage is empty
}Checks if a value exists in the storage.
| Parameter | type | Requirement | Description |
|---|---|---|---|
$needle |
mixed |
optional | The searched value |
$strict |
bool |
optional | If the third parameter strict is set to TRUE then the in_array() function will also check the types of the needle in the haystack |
| Type | Description |
|---|---|
bool |
Returns TRUE if a value exists in the storage. |
if( $vehicles->has() )
{
// if a value exists in the storage
}Creates a copy of the storage.
| Type | Description |
|---|---|
array |
Returns A copy of the storage. |
//contohnyaCopyright (c) 2016 Steeve Andrian Salim - O2System PHP Framework