Postgres Find Duplicate Values In Array Function In Php