Пример #1
0
echo "Now setting a plot to:<br />";
$film->setPlot("A lot of stuff happens");
echo $film->getPlot() . "<br /><br />";
echo "Now changing the year to :<br />";
$film->setYear("2016");
echo $film->getYear() . "<br /><br />";
echo "Now changing the director to :<br />";
$film->setDirector("Fahim");
echo $film->getDirector() . "<br /><br />";
echo "Now changing the title to :<br />";
$film->setTitle("AIDA");
echo $film->getTitle() . "<br /><br />";
echo "Now the film is: " . $film->toString() . "<br />";
echo "<h4>FilmItem Class Test</h4>";
$newFilm = new Film("E.T. 2", 2020, "Steven Spielberg");
echo $newFilm->toString();
echo "<h4>Collection Class Test</h4>";
echo "<p>Create 3 line of films and add them to the collections</p>";
$filmCollection[] = new Film("First film", 2000, "Tarantino");
$filmCollection[] = new Film("Second film", 2005, "Robert Rodriguez");
$filmCollection[] = new Film("Third film", 2010, "Steven Speilberg");
foreach ($filmCollection as $filmSingle) {
    echo $filmSingle->toString() . "<br />";
}
echo "<br/><br/><p>Collection after removing 2nd line film</p>";
unset($filmCollection[1]);
$filmCollection = array_values($filmCollection);
//used to rearrange idexes as unset doesn't rearrage them
foreach ($filmCollection as $filmSingle) {
    echo $filmSingle->toString() . "<br />";
}