Skip to content

Instantly share code, notes, and snippets.

@vigi3
Created September 24, 2018 16:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vigi3/d8d9f217b3cc92ea5939f299ff00645c to your computer and use it in GitHub Desktop.
Save vigi3/d8d9f217b3cc92ea5939f299ff00645c to your computer and use it in GitHub Desktop.
<?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;
}
}
<?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