I am not sure if I need to determine the last loop or if there is a better way to do this. But I am trying to generate a list of items within square brackets and the last item can't have a comma.
Here is my code:
content_ids: ["<?php for ($i=0, $n=sizeof($products_array); $i<$n; $i++) {echo $products_array[$i]['id'].',';} ?>"]
So this would print:
content_ids: ["1,2,3,"]
The last comma after 3 should not be there.