Php Count Similar Items In Array In Javascript