| |
Simple Coding Style for PHP - Part 2/2 |
| |
Some more guidelines:
Class Names:
-
Method Names:
The Java style is to concatenate words in multiword method names and uppercase the first letter of every word after the first. e.g.
class XML_RSS
{
function startHandler() {}
}
Naming Consistency:
Variables that are used for similar purposes should have similar names. e.g.
$max_element;
$min_element;
$sum_element;
$prev_item;
$curr_item;
$next_item;
-
Matching Variable Names to Schema Names:
Variable names that are associated with database records should always have matching names.
$query = "SELECT firstname, lastname, employee_id
FROM employees"
$results = mysql_query($query);
while(list($firstname, $lastname, $employee_id) = mysql_fetch_row())
{
//...
}
-
Documentation:
Use phpDocumentor to generate documentation on the fly. Please take a look at the software www.phpdoc.org.
Page: 1 2
Please feel free to use the comments form below if you have any questions or need more explanation on anything.
|
Tags
php,
Popular Searches
linux, php, mysql, ubuntu, mysql mysql, tools, install mysql, gearman, source code, java
more>> |
Similar Tutorials:
Tutorials in 'Web Development > PHP'
(more):
Recent Tutorials:
|
Comments (write a comment):
0 comments so far. Be the first one to leave a comment on this article.