By Love of Math.

I have to say, I absolutely adore math. It is probably one of the most amazing things, well, ever. It is obviously applicable in the programming environment – but this is the first time I’ve messed around with math itself.

Debates (38% filled, 24 of 63 speaker positions filled, 39 available)

Here’s the quick ‘n’ dirty script to get it done. Place all of the UIDs inside their own array, and apply this.

$countfilled = count($numfilled);
$countfree = count($numfree);

$total = $countfree + $countfilled;

if ($countfilled != 0 AND $countfree != 0) {
$filledfreeratio = floor($countfilled / $total * 100);
} else { // evade divide by zero
$filledfreeratio = '0';
<h2>Debates <span style="color:#999999;">
(<?php echo $filledfreeratio; ?>% filled, <?php echo $countfilled; ?> of 
<?php echo $countfree + $countfilled; ?> speaker positions filled, <?php echo $countfree; ?> available)

Leave a comment

Filed under General

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s