Reputation: 1
class StringsAndStuff {
public $repeatedString = "no means no";
public function stringRepeat($startString, $repeatCount) {
$this->repeatedString = str_repeat ($startString."</br>", $repeatCount);
}
public function stringSwitchWords($multipliedString) {
$this->repeatedString = str_replace("no", "yes", $multipliedString);
}
}
$stuff = new StringsAndStuff;
$stuff->stringRepeat($stuff->repeatedString, 5);
echo $stuff->repeatedString;
//why this won't work?
$stuff->stringSwitchWords(repeatedString);
echo $stuff->repeatedString;
I want to get a "yes means yes" string from echo at the end, but it won't work. Please, help me. Thank you for all your answers.
EDIT: Output:
no means no
no means no
no means no
no means no
no means no
repeatedString
I think it should be something more like "yes means yes" repeated 5 times.
Upvotes: 0
Views: 132