Variable Being Reset in For Loop
I'm trying to increment a variable in a for loop.
<---
$startColumn = 5;
for($rowLength = 0; $rowLength < $length; $rowLength++){
echo "New row current column : " . $startColumn . "<br />";
$startColumn++;
$newRow[$startRow][] = $startColumn;
echo "New row current column updated: " . $startColumn . "<br />"; }
--->
This outputs:
New row current column :5
New row current column updated:6
New row current column :5
New row current column updated:6...
Why is the $startColumn variable being reset to it's pre-loop value?
How can I increment this value?
|