How to Detect the First and Last Iteration in a foreach Loop in PHP | CodeTrail