Code: Select all
$array = array();
for ($i=1;$i<=10;$i++) {
$array['count']++;
}I'm wondering what people think is the "proper" way to do things. Is it ok to increment
a variable not defined? Or should one do something like this instead:
Code: Select all
$array = array();
for ($i=1;$i<=10;$i++) {
if (isset($array['count']) {
$array['count']++;
} else {
$array['count'] = 1;
}
}