funny · geeky · php code

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 Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s