Hello everyone,
I am attempting to use preg_replace but am having some difficulty.
Here is my code
$patterns[0] = “/javascript:assignRatePlan(’/”;
$patterns[1] = “/’);/”;
$patterns[2] = “/cgi-bin/”;
$patterns[3] = “NASApp/”;
$replacements[0] = “http://www.phones-nextel.com/nextel.php?data=index&ext=php&t=shop&action=add_plan&plan=”;
$replacements[1] = “&zipcode=$zipcode”;
$replacements[2] = “redirect.php?location=”;
$replacements[3] = “test”;
ksort($patterns);
ksort($replacements);
$new_code = substr($code, 115, 100000); // Returns “Removes some javacode we dont need”
$apple = preg_replace($patterns, $replacements, $new_code);
echo("$apple");
My problem is only 0-2 are being replaced. My number 3 variable is not changing what I need changed. Could someone offer some sugguestions?
Thank You