Php Check If Array Contains Key In Hashmap Javascript Map Vs Foreach