<?php
function truncate($val, $f = "0") {
if(($p = strpos($val, '.')) !== false) { }
return $val;
}
echo truncate(6.3285714285714, 2);
//https://pt.stackoverflow.com/q/317767/101
PD9waHAKZnVuY3Rpb24gdHJ1bmNhdGUoJHZhbCwgJGYgPSAiMCIpIHsKICAgIGlmKCgkcCA9IHN0cnBvcygkdmFsLCAnLicpKSAhPT0gZmFsc2UpIHsKICAgICAgICAkdmFsID0gZmxvYXR2YWwoc3Vic3RyKCR2YWwsIDAsICRwICsgMSArICRmKSk7CiAgICB9CiAgICByZXR1cm4gJHZhbDsKfQplY2hvIHRydW5jYXRlKDYuMzI4NTcxNDI4NTcxNCwgMik7CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8zMTc3NjcvMTAx