Looking Back at Old Code - jrowberg.io
Home Programming Looking Back at Old Code

Looking Back at Old Code

1 comment

I just came across the following gem in some PHP code I wrote for a web application about seven years ago:

for ($i = 0; $i < count($items); $i++) $items[$i] = $items[$i];

I cannot begin to understand the logic behind this. I’ve tried to plumb the depths of my knowledge of PHP and how variables can cause E_NOTICE messages when they are referenced while uninitialized, but I simply can’t figure out what I was trying to accomplish with that line of code.

It makes me happy to look back on what I have done and realize how much I’ve learned since then.

You may also like

1 comment

beppu April 12, 2011 - 5:34 am

I bet you were trying to copy an array but accidentally typed $items[$i] twice.


Leave a Comment