对不起,我无法在标题中清楚地解释.我用其他语言学习数学我不知道它叫什么.
我有这些价值观.
$input = 13.2156;
$input = 45.232;
$input = 1193.215624;
Run Code Online (Sandbox Code Playgroud)
我想在PHP中使用一个函数来获取点之后的内容,就是这种情况
$input = 13.2156; // 0.2156
$input = 45.232; // 0.232
$input = 1193.215624; // 0.215624
Run Code Online (Sandbox Code Playgroud)
我知道intval()反其道而行之.但我想要相反的相反.:d
$input = $input - intval($input);
Run Code Online (Sandbox Code Playgroud)
对于负数,上面的代码将获得负的小数部分(在某些情况下可能需要)。如果总是想要正小数部分,只需取 的绝对值即可$input。