Skip to content

Instantly share code, notes, and snippets.

@susanBuck
Created April 16, 2019 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save susanBuck/cd2b6c49d8ff3bf4f1b2cc9349f4db65 to your computer and use it in GitHub Desktop.
Save susanBuck/cd2b6c49d8ff3bf4f1b2cc9349f4db65 to your computer and use it in GitHub Desktop.
<?php
getAlbum(Array $albums, Int $year, String $searchType) {
$results = [];
# Filter album list according to year
foreach ($albums as $key => $album) {
$match = $year == $album['year'];
if ($match) {
$results[$album['position'] . '-' . $album[$searchType]] = $album;
}
}
return $results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment