I’ve been trying to combine 3 strings into one and having trouble doing so.
the strings are below.
$from="/2/3/4/5/6/";
$to="/30/31/32/33/34/";
$sub="/2/3/4/5/6/7/8/9/10/11/12/";#this is dynamic, ever changing past > (/2/3/4/5/6/)
the output must look like this below.
$output="/30/31/32/33/34/6/7/8/9/10/11/12/";
else if $sub changes like below then.
$from="/2/3/4/5/6/";
$to="/30/31/32/33/34/";
$sub="/2/3/4/5/6/7/8/";
$output="/30/31/32/33/34/6/7/8/";
and else if $to changes then this.
$from="/2/3/4/5/6/";
$to="/30/31/";
$sub="/2/3/4/5/6/7/8/";
$output="/30/31/6/7/8/";
the $to needs to be first, then the $sub at the end, minus the $from before the end /*/(eg./6/) to be combined into 1 string.
how is this possible?
You are basically storing array structures serialized inside strings. Clever Exploding should help:
An alternative could be regular expressions