Exemple #1
0
<div class="container">
    <div id="pageContent" class="row">
        <h4>Film Class Test</h4>
        <?php 
$title = "Gone Girl";
$year = 2015;
$film = new Film($title, $year, "john dontknow");
echo "New item created using constructor with : title = {$title} and year = {$year} <br />";
echo $film->toString() . "<br /><br />";
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) {