[PHP-DEV] Re: PHP5/ZE2: variables definition, constant variables
Victor Toni [EMAIL PROTECTED] schreef in bericht [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... 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. Regards, Leon Mergen -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DEV] Re: PHP5/ZE2: variables definition, constant variables
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
Re: [PHP-DEV] Re: PHP5/ZE2: variables definition, constant variables
Hi, To rephrase Zeev : Use error_reporting(E_ALL) Once you start using it most of the errors from undefined variables will go to oblivion. Your example is too fictional errors like $$var_name or $foo-$mCount are easy to find with the method above. Andrey - Original Message - From: Victor Toni [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Leon Mergen [EMAIL PROTECTED] Sent: Friday, January 03, 2003 3:53 PM Subject: [PHP-DEV] Re: PHP5/ZE2: variables definition, constant variables 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 -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php