Note that vars[1] is created with ' ' so that the $-names are not
interpreted.  I assume that when the text is read from the file, it comes
with the $s and the ending semi-colon (;).

<?php
$vars[1] =
'$scar=\"3\";$anrede=\"Herr\";$pf_name=\"wert\";$pf_kontem=\"tzrtzetrz\";$pf
_kontel=\"zuoioopöl\";$zeit=\"\";$pf_wt=\"löjlköjklö\";$sto=\"2\";';
print $vars[1]."\n\n";

$xx = stripslashes($vars[1]);
print $xx."\n\n";

$tmpeval=$xx; // $vars[1] is where the data is in my answer-array
eval ($tmpeval);
print $scar;
?>

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, March 27, 2002 10:34 AM
To: [EMAIL PROTECTED]
Subject: [PHP] Question on eval()


Hi Folks,
I save an ascii-sentence, representing my vars and their values in the db
after I request them, I try to eval them.
here is what I get back from the db
$scar=\"3\";$anrede=\"Herr\";$pf_name=\"wert\";$pf_kontem=\"tzrtzetrz\";$pf_
kontel=\"zuoioopöl\";$zeit=\"\";$pf_wt=\"löjlköjklö\";$sto=\"2\"; 
(values are just typed in ;-) )
then I try to eval them with

$tmpeval=$vars[1]; // $vars[1] is where the data is in my answer-array
eval ("\$tmpeval = \"$tmpeval\";");

after this ther should each var have it´s values like
$scar should be 3
$anrede should be Herr

I also tried
$tmpeval=stripslashes($tmpeval);
but that doesn´t work either.
Can anybody see my mistake, or is there any length-limit in eval ??

TIA Oliver 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to