How to replace a Token in the PHP evaluation of a Rule?
I still don't know what went wrong, but I've solved the problem in an alternative way. Everything works fine when you follow the steps underneath.


Save the integers Old value and New value as variables.
Add a third variable Result. Thanks to step 1, one can use $old_value and $new_value in the PHP evalution of this variable. I've used this code:

if ($old_value &gt; 5) {
  return 0;
}
else {
  return $new_value;
}

Convert Value to an integer Final value.
Award Final value Userpoints to the user of your choice.