I'm trying to simply add +1 to an array like this
$game['teamA']['goals']++;
But then it'll throw me an error about undefined index. And I guess that's because $game['teamA']['goals']
is not set before I am adding a value to it.
But isn't there a way to workaround this?
I could set the $game['teamA']['goals'] = 0
in start of simulation, but then I have to do that with freekicks, penalties, cards etc., AND do it for both teams. Isn't there another way of doing this?
Thanks in advance :)