RE: Re: A variable inside a variable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 
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@xxxxxxxxxxxxxxxxxxxxx] 
Sent: Monday, June 26, 2006 4:13 PM
To: php-general@xxxxxxxxxxxxx
Subject: Re:  Re: A variable inside a variable?

Please excuse-me.

That $ was putted by mistake.

I´sorry...

<tg-php@xxxxxxxxxxxxxxxxxxxxxx> escreveu na mensagem
news:FF.F9.44237.05430A44@xxxxxxxxxxxxxxx
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux