Php Reset Array After Foreach Jquery Array Count Method