Replace in given string meta data with real data.
Installation using composer:
composer require andydune/string-replace
Or if composer didn't install globally:
php composer.phar require andydune/string-replace
Or edit your composer.json
:
"require" : {
"andydune/string-replace": "^1"
}
And execute command:
php composer.phar update
It's very simple and lightweight replace. It uses str_replace
function.
use AndyDune\StringReplace\SimpleReplace;
$instance = new SimpleReplace();
$instance->one = 'one_ok';
$instance->two = 'two_ok';
$this->assertEquals(['one' => 'one_ok', 'two' => 'two_ok'], $instance->getArrayCopy());
$string = 'Gogoriki go #one# and #two#';
$instance->replace($string); // equals to 'Gogoriki go one_ok and two_ok'