Skip to content

Instantly share code, notes, and snippets.

@fubrasp
Created September 8, 2020 19:06
Show Gist options
  • Save fubrasp/507a74b492520211fdd954e1c8986b6c to your computer and use it in GitHub Desktop.
Save fubrasp/507a74b492520211fdd954e1c8986b6c to your computer and use it in GitHub Desktop.
<?php
//Enter your code here, enjoy!
class Person {
protected $name;
public function __construct($name){
$this->name = $name;
}
public function afficheMonNom() {
echo "\nJe suis ".$this->name."\n";
}
}
$pers1 = new Person("Guillaume");
$pers2 = new Person("Guillaume");
$pers3 = new Person("Cedric");
if($pers1 == $pers2) {
echo "egalite normale\n";
}
if($pers1 === $pers2){
echo "egalite stricte\n";
}
if($pers1 === $pers1){
echo "egalite stricte stupide\n";
}
if($pers3 = $pers1) {
echo "egalite malsaine";
}
echo "\n".'$pers3';
echo $pers3->afficheMonNom();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment