$b = 'abc $a def';
$a = 'whatever';
Actually, what I think you'll end up with needing is more like:
eval("$c = \"$b\"");
You can't just eval($b) because that would be like typing:
You need something roughly equivalent to:
http://php.net/eval
--
WARNING [EMAIL PROTECTED] address is an enda
> $a = "whatever";
> $b = "abc $a def";
> echo $b;
but:
$a = 'whatever;
$b = 'abc $a def';
echo $b;
doesn't do what you like (and this is more likely your problem!)
this is the clue:
$a = 'whatever;
$b = 'abc $a def';
echo eval($b);
michi
--
GMX - Die Kommunikationsplattform im Internet.
http
On Mon, 25 Jun 2001 23:09, Gunther E. Biernat wrote:
> All,
>
> This ought to be simple, but I can't crack it...
>
> I'm trying to read a plain text file where I embedded some variables.
> E.g.
>
> abc $a def
>
> Sucking this file in a string and setting $a to "whatever" results in
> "abc $a def"
On Mon, 25 Jun 2001 23:09, Gunther E. Biernat wrote:
> All,
>
> This ought to be simple, but I can't crack it...
>
> I'm trying to read a plain text file where I embedded some variables.
> E.g.
>
> abc $a def
>
> Sucking this file in a string and setting $a to "whatever" results in
> "abc $a def"
>$a = "whatever";
>$b = "abc $a def";
>echo $b;
>
>which results in "abc whatever def" ???
>
>What am I missing?
$b = "abc $a def";
That gets parsed because it's in double-quotes. Since $a is a variable, it
inputs whatever $a is, in this case "Whatever". So it ends up printnig out
"abc whatever
In article <[EMAIL PROTECTED]>,
[EMAIL PROTECTED] ("Gunther E. Biernat") wrote:
> I'm trying to read a plain text file where I embedded some variables. E.g.
>
> abc $a def
>
> Sucking this file in a string and setting $a to "whatever" results in "abc $a
> def" rather than "abc whatever def".
All,
This ought to be simple, but I can't crack it...
I'm trying to read a plain text file where I embedded some variables. E.g.
abc $a def
Sucking this file in a string and setting $a to "whatever" results in "abc $a def"
rather than "abc whatever def". Where's the difference to directly doi
7 matches
Mail list logo