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

Finding important information with SplPriorityQueue - PHP Tutorial

From the course: Learning the Standard PHP Library

Start my 1-month free trial

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…

Contents