Re: how to combine the results of two variables to echo another variable?



Dave wrote:
Hello,
I'm a somewhat PHP newbie, so please bear with me.

Here is what I am trying to do:

$foobar = "blah blah";
$a = "foo";
$b = "bar";
$fooboo = "$a" . "$b";
echo $fooboo

I know my syntax here is not correct so I am looking for the function
to make $fooboo echo out the $foobar variable "blah blah", and not as
"foobar".

Any help is appreciated.


Variable variables: http://nz.php.net/manual/en/language.variables.variable.php


$foobar = "blah blah";
$a = "foo";
$b = "bar";
$fooboo = "$a" . "$b";

$fooboo = $$fooboo;

echo $fooboo

Sacs
.



Relevant Pages

  • Problem with preg_replace
    ... font-weight: bold; ... echo $ibody; ...
    (php.general)
  • Re: php logout
    ... > I use the same page for logging in and out, ... > echo Thanks, it was great; ... > blah blah blah ... anti-PC nowdays:P ...
    (alt.php)
  • Re: PHP to echo a line in html source...
    ... <?php echo '<table>'; ... Is there anyway I can get each html tag on a seperate line in the html source so it is nice and neat? ... echo "blah blah "; ...
    (comp.lang.php)
  • Re: Obtaining random seeds
    ... I wonder if one could implement SHA-1 ... echo> foo.c << EOF ... blah blah /* randomness-generating code goes here */ ...
    (sci.crypt)