• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Round an PHP value

Dankoo

Active Member
Joined
Sep 4, 2010
Messages
1,007
Reaction score
27
How do I set an value like this: 86.43% to be shown like 86%?

I've tried with (int) code

But it hides float numbers and only show integers, I want one that rounds the value for it to become integer xD

PHP:
            $questCount   = $questCount + 1; $questStatus = $SQL->query("SELECT * FROM `player_storage` WHERE `player_id` = ".$id." AND `key` = ".$questData["storageid"].";")->fetch();
            $questPercent = (($questStatus["value"] - $questData["startvalue"])/$questData["endvalue"]) * 100;
            $main_content         .= "<center><table WIDTH=50%><td width=\"55%\">".$questName."</td><td width=\"45%\" style=\"text-align:center;\">".$questPercent."%<div style=\"background-color:white; margin-top:-14px; width: 100%; height: 12px; border: 1px solid #DDD;\"><div style=\"background: green; width: ".$questPercent."%; height: 12px;\"></div></div></td></tr></table></center>";
 
Back
Top