RE: [PHP] Re: A variable inside a variable?
| From: | Jeremy Schreckhise | Date: | Tue, 27 Jun 2006 15:15:58 +0000 |
| Subject: | RE: [PHP] Re: A variable inside a variable? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-238720@lists.php.net to get a copy of this message | ||
I ran into the same problems; here is how I solved them.
1. Install MySQL 5
2. Install PHP 5
3. Modify php.ini extensions directive to point to php_mysql.dll (the
one that was packaged with php 5)
4. Here is the tricky one make sure mysql is finding the libmysql.dll
packaged WITH MYSQL NOT PHP;
5. net stop mysql
6. net start mysql
7. work hard; play hard
-----Original Message-----
From: João Cândido de Souza Neto [mailto:joao@curitibaonline.com.br]
Sent: Monday, June 26, 2006 4:13 PM
To: php-general@lists.php.net
Subject: Re: [PHP] Re: A variable inside a variable?
Please excuse-me.
That $ was putted by mistake.
I´sorry...
<tg-php@gryffyndevelopment.com> escreveu na mensagem
news:FF.F9.44237.05430A44@pb1.pair.com...
> You were on the right track, but this isn't going to work.. for a
> couple
> reasons:
>
> $var = 1; # this is fine
> $var2 = "$var"; # $var2 == 1 at this point echo $$var2; # you're
> going to echo $1
>
> Putting $var in double quotes makes PHP evaluate it before assigning
> it to $var2, so you won't get $var but the value of $var (1).
>
> If you did use single quotes, you'd get this:
>
> $var = 1; # this is fine
> $var2 = '$var'; # $var2 == '$var' (literal) echo $$var2; # you're
> going to echo $$var
>
> It seems like you might get $var2 evaluate to $var.. then with $$var
> have it evaluate to 1, but doesn't look like PHP digs that deeply.
> When I ran it, I got NULL back.
>
> This might be what you were aiming for:
>
> $var = 1; # this is fine
> $var2 = 'var'; # remove the $.. then you can use single or double
> quotes echo $$var2; # $var == var, $var == 1, this should output
> correctly
>
> Good lesson in 'gotchas' though.
>
> -TG
>
> = = = Original message = = =
>
> $var=1;
> $var2="$var";
> echo $$var2;
>
> It~ll echo the $var~s value.
>
> Hope it~ll help you.
>
>
> ___________________________________________________________
> Sent by ePrompter, the premier email notification software.
> Free download at http://www.ePrompter.com.
--
PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:
http://www.php.net/unsub.php