' . $heading . ''; }; $content = function($content, $id, $active = false) { return '
' . $content . '
'; }; $headingAndContent = zipWith(function($heading, $content) { return ['heading' => $heading, 'content' => $content]; }, $headings, $contents); $smushenated = array_reduce($headingAndContent, function($c, $v) use ($slug, $heading, $content, $id) { return [ 'headings' => $c['headings'] . $heading($v['heading'], $id . $slug($v['heading']), !$c['headings']), 'contents' => $c['contents'] . $content($v['content'], $id . $slug($v['heading']), !$c['contents']) ]; }, ['headings' => '', 'contents' => '']); return '
' . $smushenated['contents'] . '
'; } function accordion($id, $headings, $contents) { $slug = function($string) { return str_replace(' ', '', strtolower($string)); }; $a = zipWith(function($heading, $content) use ($slug, $id) { return '
' . '
' . '' . '
' . '
' . '
' . $content . '
'; }, $headings, $contents); return '
' . glue('')($a) . '
'; } function table($headings, $rows) { return ''. '' . '' . glue('')(map(function($row) { return ''; })($rows)) . '
' . glue('')($headings) . '
' . glue('')($row) . '
'; } function scores() { $c = lines(trim(file_get_contents(glob(PATH_TO_GROOVENET . '/songs.*.txt')[0]))); echo '
';
    print_r($c);
    echo '
'; } function doIt() { $scores = require 'test.php'; return accordion( 'folders', ['Cam', 'Jayce'], [ table( ['Song', 'Difficulty', 'Pranker', 'Score'], $scores['cam'] ), table( ['Song', 'Difficulty', 'Pranker', 'Score'], $scores['jayce'] ) ] ); }