Skip to content

Instantly share code, notes, and snippets.

@khanhtran3005
Last active August 29, 2015 14:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save khanhtran3005/a9002ea4be84b5a70866 to your computer and use it in GitHub Desktop.
Save khanhtran3005/a9002ea4be84b5a70866 to your computer and use it in GitHub Desktop.
Which one do you choose?

#Christmas Tree

<?php 
    if($a) {
        if($b) {
            if($c) {
                if($d) {
                    // This is what I really want to do
                } else {
                    //Do something something else
                }
            } else {
                //Do something else
            }
        } else {
            // Do something
        }
    } else {
        //Do something
    }
    return; //blah blah
?>

#Return

 <?php
    if(!$a){
        //do something
        return;
    }
    if(!$b) {
        //do something
        return;
    }
    if(!$c) {
        //Do something else
        return;
    }
    if(!$d) {
        //Do something something else
        return;
    }
    // This is what I really want to do
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment