Re: Re: Inspiration for a Tombstone.

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

 



2008/6/28 Andrew Ballard <aballard@xxxxxxxxx>:> Say anything about efficiency never did I. :-) I was merely commenting> on a personal preference based largely on my perspective as a native> speaker of (US) English. Now - if I WERE to address efficiency, I> don't find "Yoda speak" to be any more efficient. It's usually the> same words just in a different order. What's more that order, while> quite natural for some languages, is not natural to me at all. As Bob> mentioned, it requires a little extra thought for my brain to push> certain phrases onto the mental stack before I can pop them off in an> order that "makes sense." In programming terms, any code that requires> the same amount of statements but requires more cycles to process is> not what I would consider more efficient.>> As far as the programming practice that Colin was advocating, it is> not a bad habit. And as far as the computer is concerned, the> efficiency is a wash since the number of internal steps probably> doesn't change much. However, it doesn't always work. (I know - no one> claimed it did.)>> <?php> if ($challenge_password_hash = $stored_password_hash) {>    echo 'Welcome to the club!';> } else {>    echo 'Stay out! This club is for members only!';> }> ?>>> Andrew>
In these instances you could rely on != behaviour instead of ==behaviour, like this:
<?phpif ($challenge_password_hash != $stored_password_hash) {   echo 'Stay out! This club is for members only!';} else {   echo 'Welcome to the club!';}?>
or, better yet:
<?phpif ($challenge_password_hash != $stored_password_hash) {   echo 'Stay out! This club is for members only!';   exit;}echo 'Welcome to the club!';// Lots of code here that just saved itself another indent in my IDE?>
Dotan Cohen
http://what-is-what.comhttp://gibberish.co.ilא-ב-ג-ד-ה-ו-ז-ח-ט-י-ך-כ-ל-ם-מ-ן-נ-ס-ע-ף-פ-ץ-צ-ק-ר-ש-ת;
A: Because it messes up the order in which people normally read text.Q: Why is top-posting such a bad thing?

[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