Skip to content

Instantly share code, notes, and snippets.

@masterfermin02
Created December 28, 2018 16:42
Show Gist options
  • Save masterfermin02/ab4bb403e80d38de2edd2e7419855c1e to your computer and use it in GitHub Desktop.
Save masterfermin02/ab4bb403e80d38de2edd2e7419855c1e to your computer and use it in GitHub Desktop.
<?php
# copy right Fermin Perdomo
interface day {
public function whatYouDoing();
}
class Holiday implements day {
protected $dayName = "";
public function __construct($dayName)
{
$this->dayName = $dayName;
}
public function whatYouDoing()
{
return "Es {$this->dayName}, Búscame en la fiesta!";
}
}
class RegularDay implements day {
public function whatYouDoing()
{
return "Estoy programando";
}
}
$days = [new RegularDay(), new RegularDay(), new RegularDay(), new Holiday("31 de Diciembre"), new Holiday("01 de Enero")];
foreach($days as $day){ echo $day->whatYouDoing().PHP_EOL; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment