Maybe it's just a different PHP.INI setting (this is happening on a shared hosting after an automatic update) but the essential two lines of code:
$k = array();
// some code ...
$k["assoc"]++;
If you ask why I am doing it, it's just the fastest way I know to count which and how many "elements" I have when I can only read them one at a time from "somewhere".
No problem with PHP 5, but PHP 7 is telling me this:
Notice: Undefined index: assoc in *******
I do not know in advance what associative indexes I can have, so I cannot set them at zero beforehand.
So the question is: what is the proper way to initialize an associative array in PHP7, and maybe since I am asking, is there a way to force all the elements to be e.g. integers and be set at zero by default?