Answer the question
In order to leave comments, you need to log in
Why Segmentation error (memory dumped) when executing preg_match_all function?
$array = scandir('damps');
$f = fopen('dampFirm.sql', 'w');
foreach($array as $file){
if($file != '.' && $file != '..'){
$content = file_get_contents('damps/' . $file);
/*var_dump($content);
die;*/
$result = preg_match_all("/INSERT INTO(.|\n|\r)*\)\;/U", $content, $inserts);
var_dump($inserts[0]);
die;
if($result) {
foreach ($inserts[0] as $insert) {
$str = str_replace('` (`id`, ', '` (', $insert);
$str = preg_replace("/\(\d+, /", '(', $str) . "\n";
fwrite($f, $str);
}
}
}
}
Here is the code. Answer the question
In order to leave comments, you need to log in
(.|\n|\r)*
/INSERT INTO.+?\)\;/s
die alias exit
exit - displays a message and terminates the current script
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question