> > What I do not like about PHP variables, is that they do not have to be
> > defined before use.
> 
> Well, this definately is plainly a choice. One of PHP's "goals" is to be
> very easy to learn. Many people programming PHP have never ever programmed
> before. For them, it is VERY easy to learn, because these kind of things
> (variable declaration) are not dealt with.

Indeed it is very easy to learn, but sometimes it is not very easy to
debug,
because there is no indication for missing declarations (or spelling
errors).
And the actual style has exceptions: var is used to declare variables
for classes,
but I cannot use it to declare var's for functions (or ensure I use only
declared var's).
There is also a difference between accessing a variable, static or
constant.

<?PHP
class foo {
  var $bar_v = "variable";
  const bar_c = "constant";
  static $bar_s = "static";
}

$fooo = new foo();
$bar_v = "bar_v";

print $fooo->bar_v;  // these 2 work different 
print $fooo->$bar_v;

print foo::bar_c;  // then these 2
print foo::$bar_s;

?>


Regards,

Victor Toni

-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to