This has baffled me for quit a while. I want to compare my data with the data coming next to determine when to change the row.
<?php
$seasons; // laravel eloquent model from controller
$i = 0;
$max = count($seasons);
for($i; $i<$max; $i++):
$x = $i+1;
print_r($seasons[$i]); // ok
print_r($seasons[1]); // ok
print_r($seasons[0+1]); // ok
print_r($seasons[$x]); // undefined
print_r($seasons[$i+1]); // undefined
endfor;
?>