Nedanstående filer finns i denna katalogen. Klicka på en fil för att visa dess innehåll.
dice6/
CDice.php CDiceSvg.php CHistogram.php FDice.php FHistogram.php common.php dice.php source.php template.php
<?php // =========================================================================================== // // CHistogram.php // // Description: A class for a histogram // // Author: Mikael Roos // class CHistogram { // Start of class // ------------------------------------------------------------------------------------------- // // Returns a printable string, containing the key-value-pairs. // public function ShowValues($anArray) { $s = ""; foreach($anArray as $key => $value) { $s .= "{$key} => {$value}<br />"; } return $s; } // ------------------------------------------------------------------------------------------- // // Calculate and return the average of the values. // public function Average($anArray) { return array_sum($anArray) / count($anArray); } // ------------------------------------------------------------------------------------------- // // Calculate and return the average of the values. // public function PrintGraf($anArray) { $res = Array(); // Calculate occurences for each key foreach($anArray as $key => $value) { @$res[$value] .= '*'; } ksort($res); return $this->ShowValues($res); } } // End of class ?>
. ..: © Mikael Roos, 2009