Skip to content

Instantly share code, notes, and snippets.

@MaximePawlakFr
Created January 16, 2017 13:01
Show Gist options
  • Save MaximePawlakFr/10e56df81f74a197c3acb8b432f3e58a to your computer and use it in GitHub Desktop.
Save MaximePawlakFr/10e56df81f74a197c3acb8b432f3e58a to your computer and use it in GitHub Desktop.
<!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