Skip to content

Commit 6fe4913

Browse files
committed
Added SPL implementation of a Stack example
1 parent aec556f commit 6fe4913

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

chap-04/SplStack.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: bert
5+
* Date: 3/10/18
6+
* Time: 16:40
7+
*/
8+
9+
// SPL implementation of the Stack uses the concept of Doubly Linked Lists.
10+
11+
$books = new SplStack();
12+
13+
$books->push("Introduction to PHP7");
14+
$books->push("Mastering Javascript");
15+
$books->push("MySQL Workbench tutorial");
16+
17+
echo $books->pop() . PHP_EOL;
18+
echo $books->top() . PHP_EOL;

0 commit comments

Comments
 (0)