My website was working nicely, then my host decided it was time to go with PHP 7.
I have this error:
Warning : array_rand(): Second argument has to be between 1 and the number of elements in the array in /home/HIDDEN/templates/main-template.php on line 546
Warning : Invalid argument supplied for foreach() in /home/HIDDEN/templates/main-template.php on line 547
And my code starting with line 546 and showing line 547:
$randlist = array_rand($useabletowns, count($useabletowns)-1);
foreach ($randlist as $value)