Use tokens in PHP filter
To translate the tokens in their values, you can use:

token_replace

e.g:

$nid = token_replace('[node:nid]', array('node' =&gt; $node));


You need to be able to pass the required parameters for that token, e.g $node for node tokens.