Skip to content

AndyDune/StringReplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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'