Convert percent value to decimal value in PHP
$dec = $pct / 100.00;
// if you actually have a % sign in $pct strip it out
$pct = '15%';
$dec = str_replace('%', '', $pct) / 100.00;
function percentToDecimal($percent): float
{
$percent = str_replace('%', '', $percent);
return $percent / 100.00;
}
echo floatval("6.15%") / 100.00;