Prev | Current Page 80 | Next

Emilian Balanescu and Cristian Darie

"Beginning PHP and MySQL E-Commerce: From Novice to Professional, Second Edition"


??? Variable names should be written in lowercase, with an underscore as the word separator,
such as $master_of_war.
??? Database objects use the same conventions as variable names (the department_id column).
??? Try to indent your code using a fixed number of spaces (say, four) for each level. (The
code in this book uses two spaces because of physical space limitations.)
CHAPTER 2 ?–  LAYING OUT THE FOUNDATIONS 27
Here??™s a sample code snippet:
class WarZone
{
public $mSomeSoldier;
private $_mSomeOtherSoldier;
function SearchAndDestroy($someEnemy, $someOtherEnemy)
{
$master_of_war = 'Soldier';
$this->mSomeSoldier = $someEnemy;
$this->_mSomeOtherSoldier = $someOtherEnemy;
}
}
Among the decisions that need to be made is whether to use quotes for strings. JavaScript,
HTML, and PHP allow using both single quotes and double quotes. For the code in this book,
we??™ll use double quotes in HTML and JavaScript code, and we??™ll use single quotes in PHP.
Although for JavaScript it??™s a matter of taste (you can use single quotes, as long as you use
them consistently), in PHP, the single quotes are processed faster, are more secure, and are
less likely to cause programming errors. Learn more about PHP strings at http://php.net/
types.string. You can find two useful articles on PHP strings at http://www.sitepoint.com/print/
quick-php-tips and http://www.


Pages:
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
Turcja 1 mimre.benton.pl Biuro księgowe Lublin Fundusze Emerytalne petrozawodzkich.waw.pl