From the course: Learning the Standard PHP Library
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Finding important information with SplPriorityQueue - PHP Tutorial
From the course: Learning the Standard PHP Library
Finding important information with SplPriorityQueue
- SplPriorityQueue is a specialized type of max heap that lets you reorder elements by assigning a value to indicate priority. The higher the value, the higher the element is placed in the heap. A good example of where this type of thing can come in useful, is in inspecting the contents of error logs. This is the PHP Error Log in my testing server. It contains a huge amount of data. If we scroll down to the bottom, we can see that it contains more than 57,000 lines of data. The reason that I get so many errors on my testing server, is because I'm testing to see if things break. I'm testing to find problems. Also, I've got Display Errors turned on, so I see the error as soon as it occurs. But on a live server, we have to rely on the error log. Having warnings and fatal errors mixed up with trivial items such as notices, makes it difficult to identify something that might be going wrong on a regular basis. If we scroll back up to the top here, we can see that important errors such as…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
-
-
-
(Locked)
Doubly linked lists, stacks, and queues3m 10s
-
(Locked)
Sorting XML and JSON with SplDoublyLinkedList8m 26s
-
(Locked)
Using SplStack and SplQueue6m 25s
-
(Locked)
Understanding heaps2m 55s
-
(Locked)
SplMinHeap and SplMaxHeap5m 3s
-
(Locked)
Sorting XML and JSON with SplHeap7m 9s
-
(Locked)
Finding important information with SplPriorityQueue5m 32s
-
(Locked)
Keeping priority items in chronological order4m 23s
-
(Locked)
Speeding up array access with SplFixedArray6m 48s
-
(Locked)
-