Trailing commas in an array OK in PHP

I was editing some code today and saw what looked like an error to me, but nothing was broken on the code I was looking at it, so I was prompted to look it up. And indeed, in PHP:

“Having a trailing comma after the last defined array entry, while unusual, is a valid syntax.”

So sayeth the documentation for PHP: array
If it says it in there, it must be true.
So this is legal php:

$my_array = array(‘foo’,’bar’,’bat’,);

... which, as I said, looks so bizarre to me.

Tags:

I know! Right?

I guess they classify this stuff as “syntactic sugar”—but it just looks ugly/lazy to me!

what is the value of the last element? An empty string. Syntactic sugar my foot