I am populating an array with values I read in from the database.
At the same time, I generate an array of unique values e.g. `$deptList[$row[“dept”]]++
Now, this generates a PHP Notice: `PHP Notice: Undefined index: DeptB
Is it more efficient to leave this and hide PHP Notices than it is creating an if statement to handle?
I don’t like errors but, is adding an extra if statement really needed?
Which is more efficient:
Now
`$deptList[$row[“dept”]]++
After
`isset($deptList[$row[“dept”]])?$deptList[$row[“dept”]]++:$deptList[$row[“dept”]]=0