Php Array Append If Not Exists Postgresql Interview