There is this PHP code:

$totaldead_alldef[1] = $dead['1']+$dead['2']+$dead['3']+$dead['4']+$dead['5']+$dead['6']+$dead['7']+$dead['8']+$dead['9']+$dead['10']; 

It calls this Warning:

Warning: Can not be used in / var / www / GameEngine / Automation.php on line 1551

What does this Warning mean? Why it happens? How to get rid of it?

  • one
    what is $dead ? - KoVadim
  • Read the text of the error. After a while, you don’t even need to contact Google - the cause of the error (though not always it will be clearly in the code) is always described in the text, and this error makes it clear that some variable, which is not an array, is used as an array . Most likely, you have not announced in advance $ totaldead_alldef as an array, which is allowed (within PHP), but potentially contains an error (if such a case occurs, then perhaps the encoder assumes the existence of an already created and filled array), so a warning is issued. - etki
  • $ dead is a variable that I understand you need to declare as array () - spoilt

1 answer 1

You have either $ totaldead_alldef or $ dead, or both variables are not declared as array ()

  • And you can do so $ dead = array (); ? - spoil
  • @ eprivalov1 yes, but in this code snippet you use the $ dead array already filled in, this will not be enough. - etki