I've seen some of this "lazy coding technique" lately when creating arrays (in PHP):
$arr = array(
array(
'name' => 'mr magoo',
'pet' => 'dog',
),
array(
'name' => 'superman',
'pet' => 'cat',
),
array(
'name' => 'the hulk',
'pet' => 'bear',
),
}
I absolutely see the point of having commas after each array, because it's easy to insert or delete some array without having to care about adding/deleting commas. (If I want to delete superman I just delete those rows)
$arr = array(
array(
'name' => 'mr magoo',
'pet' => 'dog',
),
array(
'name' => 'the hulk',
'pet' => 'bear',
),
}
Is there are any distadvantages/drawbacks using this "technique"? (I think what's really bugging me is that I think that PHP should generate an error or at least a warning because this commas is really not needed)
In javascript I know that there could be issues with some browsers (internet explorer of course) when having a comma (where it merely shouldn't be)
var info = {'mr maggo', 'hukl',}
but javascript is of course on the client-side, so that's another thing.