Surrounded conditions in an array