<?php
    class Histogram{
        public function __construct(){
            // Do nothing
        }

        public function __destruct(){
            // Do nothing
        }
        
        function print_histogram($rolls, $faces){
            $occurrences = array_count_values($rolls);
            echo '<ol class="histogram">';
            for($i = 1; $i <= $faces; $i++){
                $key = (string)$i;
                echo '<li>';
                if(array_key_exists($key, $occurrences)){
                    for($j = 0; $j < $occurrences[$key]; $j++){
                        echo '<span class="box"></span>';
                    }
                    echo ' ' . $occurrences[$key] . 'st';
                }
                echo '</li>';
            }
            echo '</ol>';
        }
    }
?>