Hi Experts,
I will explain the code I am working on,,, and all help is much appreciated.
Here is an oversimplified version of the code I am working with:
$seed = "seed and here is base and here is original";
$perm = "seed|base|original"; //This is the replacement string
$params = explode('|', $perm);
//This is the output
$variant = str_replace($params, "<b>{".$perm."}</b>", $seed);
echo $variant;
If you run the code I supplied,,,, You will notice that I am using $seed as a string that I am searching through in order to find any variation of the matching occurrences from $perm.
In essence I have to split $perm which I do in the$ params,, then find a match to any of the values in the $params array and replace those values with the $perm again.
In the way I am doing it now,,, the result turns out like this:
{seed|{seed|base|{seed|bas
e|original
}}|{seed|b
ase|origin
al}} and here is {seed|base|{seed|base|orig
inal}} and here is {seed|base|original}
What I need for the result is this:
{seed|base|original} and here is {seed|base|original} and here is {seed|base|original}
I do not have the option to manipulate the order in which various strings appear in the $seed string nor in $perm.
All help with this is greatly appreciated :)
Thank you.
Start Free Trial