0 ) ? "+ $lendiff" : "- " . abs($lendiff); $oldpatt = str_replace('/', '\/', $old); $newpatt = str_replace('/', '\/', $new); $pattern = '/s:(\d+)(:\\\")([^"]+?|)(' . $oldpatt . ')(.*?)\"/e'; $content = file_get_contents($infile); /* then, do a simple find/replace on the rest of the urls */ $content = str_replace($old, $new, $content); $content = str_replace($oldpath, $newpath, $content); // fix serialization lengths $content = preg_replace('!s:(\d+):"(.*?)";!e', "'s:'.strlen('$2').':\"$2\";'", $content ); file_put_contents("$infile.fixed.sql", $content); ?>