Re: PHP Standard style of writing your code

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Oh my god -- curly brackets and excessive indentation -- and curly brackets.  Just a mo, where did I put my curly-brackets-and-whitespace-glasses?  Aaaahhh, that's better!!

As you might have guessed, I *HATE* curly brackets with a vengeance, which is why I eschew both those styles and use PHP's alternative syntax:

  if (...):
     if (...):
       // mmh
     else:
       // oh
     endif;
     while (...):
       if (...):
         // oh
       else:
         if (...):
           // where am i?
         else:
           // huh!?
         endif;
         // hmm
       endif;
     if (...):
       if (...):
         // blah
       endif;
     // blah
     endif;
  // blah
  endif;

Replacing { with : and } with endif doesn't make it more readable at all.


Just beeeautiful!

Still extreme compacted code.
I just see codesalad on first look, nothing else.

 And, oh look, all the end tags tell me which kind of start tag they should match.  And the compiler.  Which leads to much more focussed error messages when you cock your structure up.  I can't remeber the last time PHP told me I had a syntax arror at the end of the file -- if I've got unbalanced start/end tags, the error message usually points to a line in the middle of the file, slap bang in the target area.
Yeah true. : and endif is nicer.
But it's a bit more about the formatting.

Barry
--
Smileys rule (cX.x)C --o(^_^o)
Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o)

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux