Fixed incorrect php constant.
Added array key/value initialization for naive foreach loop assuming each key existed.