Replace $i++ with ++$i
$i++ has the disadvantage of generating a temporary variable when incremented, which does not happen with ++$i.
Allow for quick navigation through the history
Browsers allow users to quickly navigate between pages in their history (Back and Forward buttons). This features avoids the need to request and download the page from the server for a second time. This prevents consuming unnecessary bandwidth and generating additional HTTP requests.
It is therefore recommended to not implement elements that render the page unoperational after leaving it.