I use a simple format for all my functions call DMR. Data (declare your variables), Manipulate (manipulate your data), Return (the output of the function). As simple and obvious as it seems, it took me a while before I came up with this template. It has helped me to be a more disciplined and effective programmer.
This template also includes a testbed, a little space where you do quick-and-dirty test of your functions.
<?php
/*** DOCUMENTATION
Klenwell PHP Include Template
Last Update: Jan 2007
Author: Tom at klenwell@gmail.com
FUNCTIONS
name()
NOTES
______________________________________________________________________________*/
// name
/*____________________________________________________________________________*/
function name()
{
// *** DATA
// Return
// *** MANIPULATE
// *** RETURN
} // end Fx
/*____________________________________________________________________________*/
// Testbed
/*____________________________________________________________________________*/
if ( 1 )
{
// test function
}
/*____________________________________________________________________________*/
?>
/*** DOCUMENTATION
Klenwell PHP Include Template
Last Update: Jan 2007
Author: Tom at klenwell@gmail.com
FUNCTIONS
name()
NOTES
______________________________________________________________________________*/
// name
/*____________________________________________________________________________*/
function name()
{
// *** DATA
// Return
// *** MANIPULATE
// *** RETURN
} // end Fx
/*____________________________________________________________________________*/
// Testbed
/*____________________________________________________________________________*/
if ( 1 )
{
// test function
}
/*____________________________________________________________________________*/
?>
CategoryPhp
[There are no comments on this page]