PHP Parsing and a new album

For our Web Programming lab this week we had to write a php script that would parse through an apache log file and print a summary of the root directory requests. The instructor told us that he would give us extra points if we did it with regular expressions. So, of course I did. 🙂
Check it out here: http://oz.plymouth.edu/~mpbedard/webprog/php_parse/log.php

We also had to use some php to add a better image gallery to our super hero website. I did not go too crazy with this one but here it is:
http://oz.plymouth.edu/~mpbedard/webprog/using_php2/

One thought on “PHP Parsing and a new album

  1. In the log parsing, you could have saved one whole loop by doing lines 16-19 in the same loop as the preg_match_all(). Also, the preg_match_all could have been accomplished more efficiently with preg_match() *or* you could have done one preg_match_all() without the initial loop and moved straight into line 15s loop as is. Minor stuff, but a slightly cleaner approach. Otherwise, huge props for attempting the regexp.

    In the image gallery code, you could have simplified a bit by leveraging the modulus operator as opposed to multiple loops. Again, just a tip on cleanliness.

    Good forward thinking with the nicely standardized naming convention for the images. Any thoughts on how you might handle this if they weren't so neatly structured?

Comments are closed.