I’m getting some benchmark data about page execution time. Its provided by the framework as a string. I want to convert it into a float, multiply it by 1000, and store it in the DB as an int. It seems to be acting really strange and I was hoping someone can help me figure out why. Here is the code:
$elapsed = $this->benchmark->elapsed_time();
var_dump("before:");
var_dump($elapsed);
$elapsed = floatval($elapsed);
var_dump("after:");
var_dump($elapsed);
Here is the result:

EDIT:
I figured this out thanks to someone pointing out that the string length was wrong. Apparently the method is returning the string ‘{elapsed_time}’, the framework is buffering the output, and then replacing that string with the final eval time. Thanks for the help.
Everything as expected .. but then you do something really stupid like this: