Php Reset Array After Foreach Javascript Breakdown Express