A new way of array checking in PHP

i just saw the funniest thing in PHP yet! below is taken from here.

This code is lifted from a socket handling class that I’ve been asked to work on today. Prepare to cringe:
if (eregi('Invalid argument supplied for foreach() in /usr/cvs/projects/13xx/1371/Classes/XML/XML_inc.php on line 392',$v[0])) { return false; }

It’s worth noting that the foreach() statement will move from line 392 with so much as a return key (as it did today?). It’s also worth noting that the path information is gloriously hard-coded. This was deemed dailywtf worthy in the office, and as such I present it to you now.

Happy Wednesday :)


Leave a Comment Name, email and comment are required.
Email will never be displayed.

Leave a Comment
  1. :biggrin: :blank: :blush: :bored: :confused: :cool: :down: :evil: :frown: :grin: :grr: :laidback: :left: :mad: :right: :sad: :secret: :shock: :smile: :stress: :tongue: :up: :wink: :yawn: :cute: :dead: :film: :floppy: :glasses: :grumpy: :headphones: :heart: :lightbulb: :ouch: :tv: :upsidedown: :vodka: :yell: :yuck: :yummy: