But my problem is that it keeps failing, so I am looking at the portion I know the least about: formatting a JSON in PHP. I know about the json_encode() function, and I am building an associative array, processing it through json_encode() and echoing it, but it just isn't working. Here is what I have written:
Code: Select all
$sendS = array ("monsterDmg"=>$monsterDmg, "playerDmg"=>$playerDmg, "monsterHP"=>$mobNewHp, "playerHP"=>$playerNewHp );
echo json_encode($sendS);EDIT: The rest of the code is in the file. I am just not including it because it is all passing tests and appears to be working fine.