User login

Comments

...and immediately began to wonder what on earth you had against church bulletins. ^_^

I’m thinking that preg_replace() call might not scale well. It might be more efficient to somehow cache the resulting HTML and just serve that instead (which you could do with a simple include statement), unless polls.html changes quite frequently. But I don’t know the situation; you might not really need that level of efficiency.
Also, the concatenation to $polls followed by echoing $polls probably wastes an infinitesimal about of processing power wink when you could just echo $polls (or include the cached file) and then echo ‘your registration text’ when necessary. (Yeah, I used single quotes there—heredoc seems a bit bulky for something so short.)

It turns out that I have to expand this script to serve multiple files, but caching may be a good idea if the site were slashdotted (yeah, right raspberry). The polls page probably changes once a month (as a guess).

The concatenation and then later echo is supposed to improve code readability. I cut out the processing that happened inside the if block.

For my comments in PHP, I use hashes to comment code and // or /* */ to comment out code… It just helps me see what a comment is doing without reading it.

I see. I just don’t comment my code, even though I should. wink

That’s why it’s called “code,” right?

Add new comment