Created
January 16, 2017 13:01
-
-
Save MaximePawlakFr/10e56df81f74a197c3acb8b432f3e58a 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>srcUtils</title> | |
</head> | |
<body> | |
<?php | |
// echo "Start"; | |
class StrUtils { | |
private $str = ""; | |
// x2 UNDERSCORES /!\ | |
function __construct($newString){ | |
$this->str = $newString; | |
} | |
public function bold(){ | |
$bold = "<strong>".$this->str."</strong>"; | |
$this->str = $bold; | |
} | |
public function italic(){ | |
$italic = "<em>".$this->str."</em>"; | |
$this->str = $italic; | |
} | |
public function uglify(){ | |
$this->bold(); | |
$this->italic(); | |
} | |
public function toString(){ | |
return $this->str; | |
} | |
} | |
$maString = new StrUtils("Simplon.co");// Instanciation et appel du constructeur. | |
$maString->uglify(); | |
echo $maString->toString(); | |
// $maString = new StrUtils("SimplonMIP.co"); | |
// $maString->italic(); | |
// echo $maString->toString(); | |
?> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment