[eluser]Bleeding Edge Productions[/eluser]
Hi guys,
Not that it makes the slightest bit of difference to the execution of the script, but is it better practice to declare members (particularly variables) at the top of a class, or just before they are used?
Either:
Code:
<?php
class Controllername extends Controller {
/**#@+
* @access private
* @var string
**/
protected $var1;
protected $var2;
protected $var3;
protected $var4;
/**#@-*/
function someFunction12()
{
$this->var1 = $var1;
$this->var2 = $var2;
...more code here...
}
function someFunction34()
{
$this->var1 = $var3;
$this->var2 = $var4;
...more code here...
}
?>
or:
Code:
<?php
class Controllername extends Controller {
/**#@+
* @access private
* @var string
**/
protected $var1;
protected $var2;
/**#@-*/
function someFunction12()
{
$this->var1 = $var1;
$this->var2 = $var2;
...more code here...
}
/**#@+
* @access private
* @var string
**/
protected $var3;
protected $var4;
/**#@-*/
function someFunction34()
{
$this->var1 = $var3;
$this->var2 = $var4;
...more code here...
}
?>
(obviously this is a minimal example!)
Cheers,
Martin