Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

progress bar calculate percentage php

$playerson = (int)preg_replace( '/[^0-9]/', '', $data[4]);
$maxplayers = (int)preg_replace( '/[^0-9]/', '', $data[5]);
// $percentage = floor($playerson / $maxplayers) * 100; // floor (round down) optional
// for echap to division by 0 add IF short form
($maxplayers > 0) ?  $percentage = floor($playerson / $maxplayers) * 100 : 0; 
 
PREVIOUS NEXT
Tagged: #progress #bar #calculate #percentage #php
ADD COMMENT
Topic
Name
7+6 =