Skip to content

Instantly share code, notes, and snippets.

@karloscarweber
Last active December 21, 2015 23:39
Show Gist options
  • Save karloscarweber/6383452 to your computer and use it in GitHub Desktop.
Save karloscarweber/6383452 to your computer and use it in GitHub Desktop.
Code Styling for PHP Documentation
<?php
//Some Coding Standards that I want to follow. I might as well write it down.
/*
* Functions
*/
/*
* Function Names should be lowerecased multiple words should be seperated by underscores
* private methods / functions should begin with an underscore
* Function Documentation should precede the function declaration including output type,
paramaters and their types, and a brief description of what the function does.
*/
// Example:
/*
@output (#type)
@param (#type) $param_name
@param (#type) $param_name
description of lorem ipsum
*/
function function_name($param_name = 'default_value'){
// the actual code
}
/*
* Loops
*
*/
if($something == 'true'){
// statement
} else { //line of white space above fore readability
// statements
} // no whitespace at end , but after.
//----Example----//
if($something == 'true'){
echo "It's true!";
} else {
echo "It's false.";
}
if($somethingelse == 'true'){
echo "It's also true!";
} else {
echo "It's also false.";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment