Created
September 8, 2020 19:06
-
-
Save fubrasp/507a74b492520211fdd954e1c8986b6c 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 | |
//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