How to use token in Global: PHP field In View, there is this field called "Global: PHP". I wonder how I can use token in this field in Drupal 7.  I can easily use token in "Global: Custom text" but not in "Global: PHP"
In a "Global: Custom Text" you will see a number of tokens listed under "Replacement patterns", such as [title], [php] (referring to a "Global: PHP" field), [nothing] (referring to another "Global: Custom Text" field), ...

These tokens (or replacement patterns), are not listed when working with a "Global: PHP" field, you can only see a list of "Available variables", and if you put a token in the "Output code" textarea, it does not get replaced.

However, there is a way to access these tokens in "Global: PHP" fields. For example, if you are trying to access the [nothing] token, put the following code in the "Output code" textarea (not in the "Value code" textarea):

&lt;?php
$static = $view-&gt;display_handler-&gt;get_handlers('field');
echo $static['nothing']-&gt;last_render;
?&gt;


Solution found here: https://www.drupal.org/node/507012#comment-3410296

Except it was for Drupal 6, so they used $this-&gt;view. In Drupal 7, you have to use $view.