This is the relevant code:
foreach($familyNumbers as $questionNumber) {
error_log($questionNumber);
$questionNumber = substr($questionNumber, 1);
error_log($questionNumber);
}
error_log(print_r($familyNumbers, true));
It's my understanding that the "as" variable when changed in the foreach loop should also modify the value in the array, however as my error logs show:
#10441
10441
#10442
10442
#10307
10307
#10602
10602
Array
(
[0] => #10441
[1] => #10442
[2] => #10307
[3] => #10602
)
I use foreach in other sections of my code and it works as expected, but here it does not. Should I just use a for loop for indices instead?