[PHP] Re: eval and HEREDOC

2010-07-20 Thread David Robley
Sorin Buturugeanu wrote: > Hello, > > I am having trouble with a part of my templating script. I'll try to > explain: > > The template itself is HTML with PHP code inside it, like: > > > > And I have the following code as part of the templating engine: > > $template = file_get_contents($file

[PHP] Re: eval() question

2004-04-21 Thread Jason Barnett
Orangehairedboy wrote: I would like to use eval() to evaluate another PHP file and store the output of that file in a string. Personally, I try to avoid using eval(). It can be very useful, but there are also potential security issues depending on your setup. Based on what you said in another

[PHP] Re: eval

2003-08-01 Thread Bogdan Stancescu
You can put whatever you want in eval: You could even do this: HTH Bogdan Decapode Azur wrote: Is it possible to put PHP code in eval ? Or just vars ? $string = 'The result of '; eval ($string); ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.

Re: [PHP] Re: Eval var from query

2003-07-14 Thread Kevin Stone
- 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

Re: [PHP] Re: Eval var from query

2003-07-14 Thread Shawn McKenzie
PROTECTED] > > The string you send to eval() must be valid PHP code. So try this.. > > > > eval( 'echo "'.$data.'";'); > > > > - Kevin > > > > > > - Original Message - > > From: "Shawn McKenzie" <

Re: [PHP] Re: Eval var from query

2003-07-14 Thread Shawn McKenzie
e" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Monday, July 14, 2003 1:15 PM > Subject: [PHP] Re: Eval var from query > > > > eval($data) > > > > returns Parse error: parse error, unexpected T_STRING in > > C:\apps\apache2\htdocs\te

Re: [PHP] Re: Eval var from query

2003-07-14 Thread Kevin Stone
;";'; $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

Re: [PHP] Re: Eval var from query

2003-07-14 Thread Kevin Stone
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 S

[PHP] Re: Eval var from query

2003-07-14 Thread Shawn McKenzie
eval($data) returns Parse error: parse error, unexpected T_STRING in C:\apps\apache2\htdocs\test\query.php(23) : eval()'d code on line 1 Thanks! Shawn "Shawn McKenzie" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > How can I evaluate a var that is from a text field of a database?

[PHP] Re: eval help

2003-03-03 Thread neko
ok - my latest in the eval saga is this: I want to be able to eval a function call anywhere in the string supplied, and the function call is not in scope when the string is defined. So -- somewhere in my code I wanted something like this: $string = "testing nodename: \$node->getName() pagename:

[PHP] Re: eval help

2003-03-03 Thread neko
we're in the pipe, 5-5-5."); $str = "Hello, \$name"; $str2 = "Hello, \$arr[0]"; $str3 = "Hello, \$arr2[".NAME_TAG."]"; echo doEvalWithVarsInScope($str); echo doEvalWithVarsInScope($str2); echo doEvalWithVarsInScope($str3); } function doEvalWithVarsInScope($str) { echo("trying to e

[PHP] Re: eval help

2003-03-03 Thread neko
Actually, I just realised that what I want to accomplish is different from my example - the main issue is with scope: we're in the pipe, 5-5-5."); $str = "Hello, \$name"; $str2 = "Hello, \$arr[0]"; $str3 = "Hello, \$arr2['name']"; echo doEvalWithVarsInScope($str); echo doEvalWithVarsI

Re: [PHP] Re: eval help

2003-03-03 Thread neko
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

Re: [PHP] Re: eval help

2003-03-03 Thread Dan Hardiker
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

[PHP] Re: eval help

2003-03-03 Thread neko
note that the following php: Hello, $name"; $str2 = "Hello, $arr[0]"; $str3 = "Hello, $arr2['name']"; eval ("\$evaldString = \"$str\";"); echo $evaldString; eval ("\$evaldString = \"$str2\";"); echo $evaldString; eval ("\$evaldString = \"$str3\";"); echo $evaldString; ?> produces: Broness!He

Re: [PHP] Re: eval()

2002-01-27 Thread Jason Wong
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

RE: [PHP] Re: eval()

2002-01-20 Thread Alex Dowgailenko
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

RE: [PHP] Re: eval()

2002-01-20 Thread Rasmus Lerdorf
> 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

RE: [PHP] Re: eval()

2002-01-20 Thread Alex Dowgailenko
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

Re: [PHP] Re: eval()

2002-01-20 Thread Kunal Jhunjhunwala
of cpu and memory > resources. Agreed. Regards, Kunal Jhunjhunwala - Original Message - From: "Michael Waples" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, January 20, 2002 6:39 PM Subject: [PHP] Re: eval() > Kunal Jhunjhunwala wrote: > > >

[PHP] Re: eval()

2002-01-20 Thread Michael Waples
Kunal Jhunjhunwala wrote: > > 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. > Regards, > Kunal Jhunjhunwala well for looping through the results of a sql query whe

Re: [PHP] Re: eval()

2002-01-20 Thread Nick Wilson
-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

[PHP] Re: eval()

2002-01-20 Thread Kunal Jhunjhunwala
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. Regards, Kunal Jhunjhunwala - Original Message - From: "Michael Waples" <[EMAIL PROTECTED]> To: "Kunal Jhunjhunwala"

[PHP] Re: eval()

2002-01-20 Thread Michael Waples
Kunal Jhunjhunwala wrote: > > Hey > Does anybody know if its wise to use eval() ? I know Vbulletin uses it.. but > there is something about it I just cant digest.. it seems to be a very > powerfull function which can be very easily exploited... anyone else have > any thoughts? > Regards, > Kunal

[PHP] Re: eval on a form

2001-12-10 Thread Hugh Bothwell
"Paul Roberts" <[EMAIL PROTECTED]> wrote in message 000d01c18101$5dbb2220$01f8883e@laptop1">news:000d01c18101$5dbb2220$01f8883e@laptop1... > Hi > > I'm trying to pre-fill a form ( the data is passed via sessions or from > another script). > > i have some check boxes on the form that i would like