For PHP's isset(), you may simply compare the variable with null, ie. "myVar != null".
if(bonus[id] != null)
score += bonus[id];
or with ternary operator
score += (bonus[id] != null) ?: bonus[id];
Sidenote:
I believe, you could also try a PHP in_array()
solution by using Lambda.has(arrayOrMap, "key");
. But i don't know exactly if Lambda.has works on Maps.
But still, the !=
would be faster than a call to in_array()
.