Skip to content

Commit c66afb0

Browse files
committed
Created example using the SPL Doubly Linked List
1 parent 7471845 commit c66afb0

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

chap-03/SplDoublyLinkedList.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
/**
3+
* Created by PhpStorm.
4+
* User: bert
5+
* Date: 3/10/18
6+
* Time: 13:53
7+
*/
8+
9+
$bookTitles = new SplDoublyLinkedList();
10+
11+
$bookTitles->push("Introduction to Algorithms");
12+
$bookTitles->push("Introduction to PHP and Data Structures");
13+
$bookTitles->push("Programming Intelligence");
14+
15+
$bookTitles->add(1, "Introduction to Calculus");
16+
$bookTitles->add(3, "Introduction to Graph Theory");
17+
18+
for ($bookTitles->rewind(); $bookTitles->valid(); $bookTitles->next()){
19+
echo $bookTitles->current() . PHP_EOL;
20+
}

0 commit comments

Comments
 (0)