blob: 8ea32ab187fd37de4965103b783555ea57c3e7db [file] [log] [blame]
<?php
$rawJson = file_get_contents("php://stdin");
$json = json_decode($rawJson, true);
$students = [];
foreach ($json['songs'] as $song) {
foreach ($song["performers"] as $instrument) {
foreach ($instrument['names'] as $s) {
if (!isset($students[$s])) $students[$s] = [];
$students[$s][] = $song;
}
}
}
foreach ($students as $s => $songs) {
echo '==='.$s.'==='.PHP_EOL;
foreach ($songs as $song) {
echo ' - '.$song['begins'].' '.$song['title'].' '.PHP_EOL;
}
echo PHP_EOL;
}