also, hier erstmal der code:
das ergebnis:
woran könnte das liegen, und wie behebt man das?
bin ziemlich verzweifelt...
PHP-Code:
<?
$la = 1;
$data = "hallo if(\"var_la_\"==\"1\"){\"hi\"} hallo";
preg_match_all('/if\(\"(.*?)\"(.*?)\"(.*?)\"\){\"(.*?)\"}/',$data,$matched,PREG_PATTERN_ORDER);
$operator = $matched[2][0];
$varone = $matched[1][0];
preg_match_all('/var_(.*?)_/',$varone,$matchvar,PREG_PATTERN_ORDER);
if($matchvar[1][0]) {
$varone = ${$matchvar[1][0]};
}
$vartwo = $matched[3][0];
preg_match_all('/var_(.*?)_/',$vartwo,$matchvar,PREG_PATTERN_ORDER);
if($matchvar[1][0]) {
$vartwo = ${$matchvar[1][0]};
}
$output = $matched[4][0];
$toreplace = $matched[0][0];
$operator = $matched[2][0];
if ($operator == "==") {
if($varone == $vartwo) {
echo "original data:<br>";
echo $data;
echo "<br>to replace:<br>";
echo $toreplace;
str_replace($toreplace,$output,$data);
}
}
echo "<br>replaced:<br>";
echo $data;
?>
Code:
original data: hallo if("var_la_"=="1"){"hi"} hallo to replace: if("var_la_"=="1"){"hi"} replaced: hallo if("var_la_"=="1"){"hi"} hallo
bin ziemlich verzweifelt...
Kommentar