How do I create a new variable?
Is it possible to add a new variable?


YES




  Is it possible to use a function like array_unique()?


Yes, as long as you have an array to pass as a parameter.

PS: You shouldn't be using Views PHP to begin with; you should create a template file for your view and add the PHP code there.

What are the downsides of using PHP Filter code in blocks, nodes, views-args, etc?