Php Loop Over Array Javascript Length Of Arraylist