mattst88's blog - My Daily WTF moment

My Daily WTF moment

I read The Daily WTF from time to time in amazement. I've never had a WTF moment even relatively worthy of their site, until today...

                        <?php  if (isset($secondary_links)) : ?>
                 <?php  print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>

		    <?php

		                               endif;

					                                   ?>

This is exactly how the code appears, spacing included. Fixing up the spacing only makes you wonder why-tf anyone would write PHP in this style.

<?php if (isset($secondary_links)): ?>
<?php print theme('links', $secondary_links, array('class' => 'links secondary-links')) ?>
<?php endif; ?>

So what's wrong with this code?

  1. Spacing–the author had to try to make it this atrocious
  2. Opening and closing <?php for consecutive lines–what gives, really?
  3. Wonky if(): endif; syntax–are we in 1998 again

By the way, writing unreadable code does not help your job security if you have to ship it to customers.

– Tags: rant work