RE: [PHP] Eval()??? A variables contents?
http://www.php.net/manual/en/function.eval.php Kirk > -Original Message- > From: Christopher Raymond [mailto:[EMAIL PROTECTED]] > Sent: Friday, November 09, 2001 1:11 PM > To: PHP List > Subject: Re: [PHP] Eval()??? A variables contents? > > > on 11/9/01 2:01 PM, Kurt Lieber at [EMAIL PROTECTED] wrote: > > > What you're doing doesn't make any sense. If it were to > work, it would look > > like the following: > > > > ; ?>, > > > > or something similar. I think what you want to do is: > > > $content = query_database($category); > > echo $content; > > ?> > > > > that's using psuedo-code, of course. You'll want to > substitute correct php > > syntax for returning database results. > > > > > Kurt: > > I understand where you are coming from, and I appreciate your answer. > However, I'm trying to get PHP to parse commands that are stored in a > variable because I'm passing those commands to a function. Inside the > function, it needs to evaluate the commands stored in the variable. > > Does you solution solve that or does my description clarify my problem > better? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Eval()??? A variables contents?
on 11/9/01 2:01 PM, Kurt Lieber at [EMAIL PROTECTED] wrote: > What you're doing doesn't make any sense. If it were to work, it would look > like the following: > > ; ?>, > > or something similar. I think what you want to do is: > $content = query_database($category); > echo $content; > ?> > > that's using psuedo-code, of course. You'll want to substitute correct php > syntax for returning database results. Kurt: I understand where you are coming from, and I appreciate your answer. However, I'm trying to get PHP to parse commands that are stored in a variable because I'm passing those commands to a function. Inside the function, it needs to evaluate the commands stored in the variable. Does you solution solve that or does my description clarify my problem better? Thanks, Christopher -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Eval()??? A variables contents?
I just asked a similar question yesterday. The answer is, conveniently enough, eval(). One trick from the php.net page on the function is to do somehting like this: $content = ""; echo eval ("?>$content"); Christopher Raymond wrote: > > PHP Gurus: > > I have one for you. I'm sure there is a simple solution, but I'm having > difficulty finding it. > > Let's say I have: > > $content = ""; > > If I use , it doesn't evaluate that content. What am > I doing wrong here? > > Is there an equivalent to JavaScript's eval($commands) function? > > TIA, > > Christopher Raymond > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Eval()??? A variables contents?
On Friday 09 November 2001 11:51 am, Christopher Raymond wrote: > Let's say I have: > > $content = ""; > > > If I use , it doesn't evaluate that content. What am > I doing wrong here? What you're doing doesn't make any sense. If it were to work, it would look like the following: ; ?>, or something similar. I think what you want to do is: that's using psuedo-code, of course. You'll want to substitute correct php syntax for returning database results. --kurt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]