Created
September 24, 2018 16:21
-
-
Save vigi3/d8d9f217b3cc92ea5939f299ff00645c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Personnage{ | |
public $nom; | |
public $prenom; | |
public $adresse; | |
public $date; | |
public function dire(){ | |
return $this->nom.' '.$this->prenom.' '.$this->adresse.' '.$this->date; | |
} | |
public function calcul(){ | |
$age= 2018 - $this->date; | |
return ' '.$age. "ans"; | |
} | |
public function setadresse($adresse){ | |
return $this->adresse=$adresse; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require 'Personne.php'; | |
$vince = new Personnage(); | |
$vince->nom = "REI"; | |
$vince->prenom = "Vincent"; | |
$vince->adresse = "Wild code"; | |
$vince->date = "1997"; | |
echo $vince->dire(); | |
echo $vince->calcul(); | |
$vince->setadresse(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment