This is a function I find myself writing quite often, so I thought I would just post it here for future reference. It's purpose is simple, check if an array contains an element with a given key and value, if it does, return it other wise return a null value.