I did it!
I'm not skilled with php, but I figured out that the response ID variable is
$saved_id = $_SESSION
Since I cannot use a php script in a question text, I have to create a placeholder to use in a boilerplate question.
The placeholders are created in the common_functions.php
I copied the function that create the placeholder {NUMBEROFQUESTIONS} and added to the next line. I renamed the placeholder and I replaced the variable $totalquestionsAsked with $_SESSION.
The line to add is
if (strpos($line, "{PLACEHOLDER}") !== false) $line=str_replace("{PLACEHOLDER}", $_SESSION, $line);
I guess it's not the best way to do it, but it works fine for me.