How to use variables in a PHP evaluation in a rule?
You can achieve this,  use variable module and define variable which you want use in rule.

To define a variable you need to write custom module , which will contain following function

function My_module_variable_info() {
  $variables['rainbow_count'] = array(
  // 'name' isn't really necessary, as it will get populated from the key of this array above.
 'name' =&gt; 'rainbow_count',
 'title' =&gt; t('Number of Rainbows'),
 'type' =&gt; 'number',
 'group' =&gt; 'UserPoints Config',
 'token' =&gt; TRUE,
'default' =&gt; 0,
'description' =&gt; t('Specify the number of rainbows.')
); 

}


Set value for variable which you want use in rule through : 

configuration&gt;&gt;variables&gt;&gt;modules&gt;&gt;My_module_...

Now go to rules >action> grant points to a user > Points:

Set data type =current-user:uid  and put return variable_get('rainbow_count'); code in PHP evaluation.

This solution worked for me,hope will help you also.