- Original Message -
From: "Shawn McKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 14, 2003 1:51 PM
Subject: Re: [PHP] Re: Eval var from query
> Thanks Kevin! That works great. It outputs: hi my name is Shawn
>
> Now if I want
Got it!
eval( '$newdata = "'.$data.'";');
Thanks!
Shawn
"Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> Thanks Kevin! That works great. It outputs: hi my name is Shawn
>
> Now if I want to assign $data to another var, let's say $newdata and have
it
> eval the $n
Thanks Kevin! That works great. It outputs: hi my name is Shawn
Now if I want to assign $data to another var, let's say $newdata and have it
eval the $name var inside of that. How would that work?
Meaning I want to $newdata = hi my name is Shawn
Thanks!
Shawn
"Kevin Stone" <[EMAIL PROTECTED
;";';
$name = 'Shawn';
eval($code); // prints "hi may name is Shawn".
Hope that makes it more clear.
- Kevin
- Original Message -
From: "Kevin Stone" <[EMAIL PROTECTED]>
To: "PHP-GENERAL" <[EMAIL PROTECTED]>
Sent: Monday, J
The string you send to eval() must be valid PHP code. So try this..
eval( 'echo "'.$data.'";');
- Kevin
- Original Message -
From: "Shawn McKenzie" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, July 14, 2003 1:15 PM
Subject: [PHP] Re: Eval var from query
> eval($data)
>
>
Thanks Dan - I just worked this out before reading your solution! :)
$str4 = "Hello, ".$arr2['name'];
cheers and thanks to all - lets see how that goes within my framework now :)
neko
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Hi,
> $arr2["name"] = "Broness!";
..
> $str3 = "Hello, $arr2['name']";
..
> eval ("\$evaldString = \"$str3\";");
> echo $evaldString;
Your almost there... just remember one very simple rule - if in doubt,
break out. Meaning, if you're having variable resolution issues, then just
break out of the
On Monday 21 January 2002 12:17, Alex Dowgailenko wrote:
> After getting very frustrated with arrays, I ended up using eval() in the
> following way:
>
> function top10() {
> $i = 0;
> $res = mysql_query("SELECT orders.pid, products.pid, orders.amount,
> products.pname FROM orders, pro
s angry and depressed that I wasn't getting paid enough for
what I was doing so I took the easy way out. It's the only time I ever used
eval() in PHP.
> -Original Message-
> From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]]
> Sent: January 20, 2002 11:22 PM
> To: Alex Do
> while (list($opid, $ppid, $amount, $pname) = mysql_fetch_row($res)) {
> $eval = '$temp["'.$pname.'"] = $temp["'.$pname.'"] + '.$amount.';';
> eval($eval);
> $i++;
Whoa... Why not simply:
$temp[$pname] += $amount;
??
-Rasmus
--
PHP General M
After getting very frustrated with arrays, I ended up using eval() in the
following way:
function top10() {
$i = 0;
$res = mysql_query("SELECT orders.pid, products.pid, orders.amount,
products.pname FROM orders, products WHERE orders.uid!='' AND
orders.pid=products.pid") or die(my
> I don't see how you can avoid putting php code in templates because you
> need to put $var in there some way so you can print out the variable. So
> if it's in a database it needs some eval() done on it.
You could html comment lines?? I tried this.. but it would only consider the
first and the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
* On 20-01-02 at 13:26
* Kunal Jhunjhunwala said
> Hey,
> I tend to agree with you. But what is the most effiecent way of using php
> code in template files then? I am not going to move my templates to a
> dbase.. thats for sure.
The point of
13 matches
Mail list logo