How to check if a value exists in an array with in_array for Bash

When working with Bash it might become handy to have a way to check if a record exists in an array. In PHP you have in_array for this… The below code adds a function similar to the PHP variant.