- var_dump: documentation ( source)
- addslashes: documentation ( source)
- ini_set: documentation ( source)
- ini_get: documentation ( source)
<?php
echo 'Using default precision:',PHP_EOL;
$time = $_SERVER['REQUEST_TIME_FLOAT'];
var_dump(ini_get('precision'));
var_dump($time);
$time_string = addslashes($time);
var_dump($time_string);
$recast_time = (float) $time_string;
var_dump($recast_time);
var_dump($time === $recast_time);
echo PHP_EOL,'Using substantially higher precision:',PHP_EOL;
ini_set('precision', 50);
$time = $_SERVER['REQUEST_TIME_FLOAT'];
var_dump(ini_get('precision'));
var_dump($time);
$time_string = addslashes($time);
var_dump($time_string);
$recast_time = (float) $time_string;
var_dump($recast_time);
var_dump($time === $recast_time);