I am stuck with getting a change in an specific value in an array.
The following is the relevant code I use in the moment:
$countryCountList=array("Italy"=> 0, "USA"=> 0);
$localResult=mysqli_query($con, $queryforcheck) or die("Errormessage: %s
". $con->error);
$wholeCountryArray = $localResult->fetch_array(MYSQLI_NUM);
foreach($wholeCountryArray as $rowCountry) {
$countryCountList[$rowCountry]=$countryCountList[$rowCountry]+1;
}
return $countryCountList;
So I want to count some values in the array "countryCountList" up in the foreach-loop. I can proof that the foreach is counting, but when it comes to the return at the end of my php-file it returns the values that where defined in the first line of this snippet of code.
So it seems that foreach does counting the values of the array up but doesn´t save it to return it succesfully.
Hope this is enough information. Anybody an idea?