1, 'name' => 'pop'], ['id' => 2, 'name' => 'hip-hop'], ['id' => 3, 'name' => 'rock'], ['id' => 4, 'name' => 'jazz'], ['id' => 5, 'name' => 'classic'], ]; $music = [ ['id' => 1, 'id_styles' => 5, 'href' => 'https://azbyka.ru/audio/audio1/Muzyka-i-pesni/populjarnaja-klassicheskaja-muzyka/65_iogann_sebastjyan_bah_i_sharlj_guno__sotis_ave_mariya_.mp3'], ['id' => 2, 'id_styles' => 5, 'href' => 'https://azbyka.ru/audio/audio1/Muzyka-i-pesni/populjarnaja-klassicheskaja-muzyka/107_zuppe_uvertyura_k_opere_legkaya_kavaleriya.mp3'], // ['id'=> 3, 'name'=> 'rock'], // ['id'=> 4, 'name'=> 'jazz'], // ['id'=> 5, 'name'=> 'classic'], ]; $str = ""; foreach ($arr as $item) { $str .= "
  • " . $item['name'] . "
  • "; } echo (''); $select = ""; $options = ""; foreach ($arr as $item) { $options .= ""; } $select = ''; echo ($select); $box = []; if ( $handle = opendir('C:\\Lerning\\lerning-php\\itmo-php-course\\engine\\upload') ) { // echo "Directory handle: $handle\n"; // echo "Entries:\n"; /* This is the correct way to loop over the directory. */ while (false !== ($entry = readdir($handle))) { $ext = pathinfo($entry, PATHINFO_EXTENSION); // echo $ext ."\n"; if ($ext == 'mp3') { array_push($box, "C:\\Lerning\\lerning-php\\itmo-php-course\\engine\\upload\\$entry"); } } closedir($handle); } // var_dump($box); $playlist = ""; foreach ($box as $item) { $playlist .= ''; }; // $playlist = ""; echo ($playlist);