I have seen examples like the following:
$data = array(
\'username\' => $user->getUsername(),
\'userpass\' => $user->getPassword(),
\'em
Because it keeps entries uniform.
If you've had to swap the order, or add or delete entries, you know being able to leave a trailing comma is very convenient.
If the last element cannot have a comma, then you end up having to maintain the last comma by modifying entries. It's a pointless exercise and a waste of time and finger strokes because the intent of swapping or modifying entries is already accomplished.
By allowing a trailing comma on the last element, it frees the programmer from having to tend to this annoying and fruitless detail.