It's not important in PHP. Debugging is a pretty negligible challenge in PHP, IMO.
Warrior, I'm not saying there's no advantage, I'm just saying its a moot effort. It's trying to make PHP something it's not. You're adding another unnecessary failure point.
Besides, if you use intuitive, predictable variable names, it doesn't do much for you declaring them at the beginning of a function. Most PHP code I use is outside of a function anyway. Most variables I handle are in a superglobal array, so moving them to a variable of lower scope is often a waste of time and resources.
Secondly, since variable types in PHP are determined completely by implicit methods, declaring variables doesn't increase the clarity of the code by that much. Declaring a variable in PHP (obviously) would look like this:
$int_variable = 0;
$str_variable = '0';
$flt_variable = '1.0';
$bol_variable = true;
Declaring a variable's scope in PHP is obviously a different story. I ALWAYS do this because not doing it is a complete waste of time, cleanliness of code and intelligence. If you have something like:
$db = new mysql_db();
function get_username($user_id, $db) {
// ...
}
get_username(1, $db);
It's pretty stupid when you can save a lot of trouble by doing:
$db = new mysql_db();
function get_username($user_id) {
global $db;
// ...
}
get_username(1);