Hi,
Angenommen ich hätte folgenden Code in der Datenbank stehen:
$i = $_POST['nummer'];
if($i != 1) {
echo "Die Zahl ist nicht 1";
} else {
echo "Die Zahl ist 1";
}
>
> Eval würde ich aber so einsetzen:
> [...]
> $test = $row['Nummer'];//$row['Nummer'] soll die oben enthaltene IF-ELSE-ABFRAGE enthalten.
> eval ("\$zahl = \"$test\";");
> echo $zahl;
Was zum Geier willst du denn mit $zahl = "irgendwas"?
"irgendwas" ist immer noch ein Textliteral.
[Schon ganz zu Beginn](https://forum.selfhtml.org/?t=172166&m=1127875) wies ich dich darauf hin, dass es bloedsinnig ist, PHP-Code als Textliteral zuweisen zu wollen, und dann anzunehmen, er wuerde dadurch ausgefuehrt ... Noch mal: Das machst du so doch auch nicht, wenn du etwas ohne eval ausfuehren willst - also warum versuchst du das hier?
> So, wie kann ich jz diese IF-ELSE-ABFRAGE (welche in einem Array o. String enthalten ist) ausführen?
~~~php
$code = '$i = 1;
if($i != 1) {
echo "Die Zahl ist nicht 1";
} else {
echo "Die Zahl ist 1";
}';
eval($code);
Was ist daran so kompliziert?
MfG ChrisB
--
"The Internet: Technological marvel of marvels - but if you don't know *what* you're lookin' for on the Internet, it is nothing but a time-sucking vortex from hell."
"The Internet: Technological marvel of marvels - but if you don't know *what* you're lookin' for on the Internet, it is nothing but a time-sucking vortex from hell."