Php Count Similar Items In Array Javascript Methods And Functions