What are some alternative methods to avoid adding a comma after the last item in a loop in PHP?

When looping through an array in PHP and concatenating the elements with a comma, you may want to avoid adding a comma after the last item. One way to achieve this is by using the `implode()` function to join the array elements with a comma instead of manually adding commas in the loop. This will automatically handle the comma placement without the need for special logic to exclude the comma after the last item.

// Example array
$fruits = array("Apple", "Banana", "Orange");

// Using implode to join array elements with a comma
echo implode(", ", $fruits);