Cálculo percentual em array...
<?php $result = array('a' => 2, 'b' => 4, 'c' => 1, 'd' => 0, 'e' => 0); $total = array_sum($result); foreach( $result as $key => $value ){ echo $key.' = '. round($value * 100) / $total .'%'; }