Programming-Idioms

Implementation
PHP

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating resource.

Please try to avoid dependencies to third-party libraries and frameworks.

Implementation edit is for fixing errors and enhancing with metadata.

Instead of changing the code of the snippet, consider creating another PHP implementation.

Other implementations
import java.util.Map;
m.containsKey(k)
_, ok := m[k]
k in m
exists $m->{$k}
k in m
use std::collections::HashMap;
m.contains_key(&k)
if (k in m) { }
m.containsKey(k)
uses fgl, classes;
m.IndexOf(k) >= 0
m.include?(k)
Map.has_key?(m, k)
(/=Nothing) (lookup k m)
maps:is_key(K, M).
m[k] ~= nil
#include <map>
bool key_exists = m.find(k) != m.end();
m.key?(k)
m.has_key?(k)
(assoc k m)
import qualified Data.Map.Strict as Map
Map.member k m
bool keyExists = m.ContainsKey(key)
def contains[K](map: Map[K, _], key: K): Boolean =
  map.contains(key)
m.hasOwnProperty(k)
import kotlin.collections.map
map.containsKey(key)
(contains? m k)
_m.has(_k)
_, ok := m[key]
#include <map>
bool key_exists = m.count(k) != 0;
#include <map>
bool key_exists = m.contains(k);
If m.ContainsKey(k) Then...