How do I create a new variable? I want to use a new variable in a view using global PHP. Between the available variables, I have $row-&gt;my_field, and I want to put its value in a new variable.

$new = $row-&gt;my_field;
echo $new


I'm using this code in Output Code. I get the following error:


  Syntax error, unexpected 'echo' (T_ECHO) ...


I cannot even use array_unique().

Is it possible to add a new variable? and Is it possible to use a function like array_unique()?
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?