$from = str_replace($match[0], $placeholder, $from);
$to = str_replace($match[0], '$' . ($i + 1), $to);
}
$from = preg_quote($from, '#');
foreach ($findReplacements AS $findPlaceholder => $findReplacement)
{
$from = str_replace($findPlaceholder, $findReplacement, $from);
}
return ['#^' . $from . '#', $to];
/* if (substr($from, -1) == '/' && substr($to, -1) == '/')
{
// both end in slashes, make the last slash optional
$matchId = $varMatches;
$placeholder = $replacementChr . $matchId . $replacementChr;
$findReplacements[$placeholder] = '(/?)';
$from = substr($from, 0, -1) . $placeholder;
$to = substr($to, 0, -1) . '$' . ($matchId + 1);
}
$from = preg_quote($from, '#');
foreach ($findReplacements AS $findPlaceholder => $findReplacement)
{
$from = str_replace($findPlaceholder, $findReplacement, $from);
}
return ['#^' . $from . '#', $to];
*/