Skip to content

jacekpl/regex-replace-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

regex-replace-template

Usage:

$rr = new RegexReplace();
$str = "Hello {name,fallback=Customer}, this is a message sent to {email}, we'll be in touch in writing at {address,fallback=Your Postal Address}";

$data1 = array(
    'name' => "John Smith",
    'email' => "[email protected]",
    'address' => NULL,
);

$data2 = array(
    'name' => NULL,
    'email' => "[email protected]",
    'address' => "123 Berkshire Road, London",
);

echo $rr->execute($str, $data1);
//Hello John Smith, this is a message sent to [email protected], we'll be in touch in writing at Your Postal Address

echo $rr->execute($str, $data2)
//Hello Customer, this is a message sent to [email protected], we'll be in touch in writing at 123 Berkshire Road, London

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages