Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $files = glob('*.txt');
- $stack = array();
- foreach ($files as $file) {
- $content = substr(file_get_contents($file), 0, -1);
- $students = array_unique(explode('|', $content));
- foreach ($students as $student) {
- if (empty($student) === true) {
- continue;
- }
- if (array_key_exists($student, $stack) === false) {
- $stack[$student] = 1;
- } else {
- $stack[$student] = $stack[$student] + 1;
- }
- }
- }
- asort($stack);
- foreach ($stack as $k => $v) {
- echo sprintf('%s était là durant %d séances'."\n", $k, $v);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement