Justtechjobs.com Find a programming school near you






Online Campus Both


php-general | 2000071

Re: [PHP] problem with eval() From: Alan Gillespie (alan <email protected>)
Date: 07/14/00

'fraid these suggestions don't work either.

maybe I'm expecting PHP to do too much other than the
simple replacement of values in Strings.
I accept that if I declare variables
$value = 1 and
$today = 1

in my 'application' then parse the Src_File it
substitutes the values of $value & $today for their
numeric value, but I thought I should still be able to
evaluate/process the statement, and if there is any
result/output, pass this back to the string you've
assigned ($new_string)

very puzzled & confused,

alan

> >
> > You probably want something along the lines of:
> >
> > $complete_code = '($value == $today) ? "Hello
World" : ""';
> >
> > and then
> >
> > eval("\$new_string = \"$complete_code\";);
>
> Actually, get rid of the \"'s there.
>
> -Rasmus
>

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe <email protected>
For additional commands, e-mail: php-general-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>