PHP Classes

PHP Collection Example Class: Manage a playlist using SplDoublyLinkedList class

Recommend this page to a friend!
  Info   View files Example   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 63 This week: 1All time: 10,388 This week: 560Up
Version License PHP version Categories
tocadordemusica 1.0.0The PHP License5PHP 5, Audio, Data types
Description 

Author

This is a simple example class that can manage a playlist using the SplDoublyLinkedList class.

It provides several functions that can be used to manage a list of songs that can be played by an application. Currently it can:

- Add songs to the playlist from a fixed array of sons
- Display the name of song that is currently playing
- Add one song to the end or beginning of the playlist
- Move on to the next or the previous song in the play list
- Display the name of the songs on the play list
- Display the total number of the songs on the queue
- Remove a song from the beginning or end of the playlist

In Portuguese:

O Heap é uma collection do PHP.

O Set é uma collection que tem uma característica muito importante com relação aos elementos que armazena.

A fila é uma Collection do PHP que tem uma característica principal em relação ao armazenamento e busca das informações que armazena.

A pilha é uma Collection do PHP que tem uma característica principal em relação ao armazenamento e busca das informações que armazena.

Utilizamos a SplDoublyLinkedList para armazenarmos as músicas em nosso tocador, a principal característica dessa classe é que ela implementa uma lista duplamente ligada.

Picture of Raphael Paez
  Performance   Level  
Name: Raphael Paez <contact>
Classes: 3 packages by
Country: Brazil Brazil
Age: ???
All time rank: 2729190 in Brazil Brazil
Week rank: 411 Up35 in Brazil Brazil Up
Innovation award
Innovation award
Nominee: 2x

Winner: 1x

Example

<?php

require 'TocadorDeMusica.php';

$musicas = new SplFixedArray(2);

$musicas[0] = "One Dance";
$musicas[1] = "Closer";

$musicas->setSize(4);

$musicas[2] = "rockstar";
$musicas[3] = "Love Yourself";

$tocador = new TocadorDeMusica();

$tocador->adicionarMusicas($musicas);

$tocador->adicionarMusicaNoComecoDaPlaylist("Havana");

$tocador->removerMusicaDoComecoDaPlaylist();

$tocador->removerMusicaDoFinalDaPlaylist();

$tocador->exibirMusicas();


  Files folder image Files  
File Role Description
Accessible without login Plain text file exemplo.php Example Aulas php
Plain text file TocadorDeMusica.php Class Aulas php

 Version Control Unique User Downloads Download Rankings  
 0%
Total:63
This week:1
All time:10,388
This week:560Up