Skip to content

Latest commit

 

History

History
52 lines (37 loc) · 1.38 KB

README.md

File metadata and controls

52 lines (37 loc) · 1.38 KB

StringReplace

Build Status Software License Packagist Version Total Downloads

Replace in given string meta data with real data.

Installation

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

SimpleReplace

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'