Php Loop Over Array Javascript Length Validation Vs Verification