# variable variables in global - bug?

- Thread: https://externals.io/message/580
- Original archive: https://news-web.php.net/php.internals/580
- Started by Greg Beaver on 2003-04-02T03:10:48+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #580 — Greg Beaver — 2003-04-02T03:10:48+00:00

URL: https://externals.io/message/580#580

Hi,

It was brought to my attention that this code is legal in PHP 4:

function foo($param = 'test')
{
     global $$param;
     echo $$param;
}

$test = 'bar';
foo(); // prints bar

Is this a feature or a bug? (Should we support this syntax in 
phpDocumentor, or might it change in php 5?)

Greg
--
phpDocumentor
http://www.phpdoc.org

---

## #581 — pollita@php.net — 2003-04-02T04:13:56+00:00

URL: https://externals.io/message/580#581 · In reply to: #580

> It was brought to my attention that this code is legal in PHP 4:
>
> function foo($param = 'test')
> {
>      global $$param;
>      echo $$param;
> }
>
> $test = 'bar';
> foo(); // prints bar
>
> Is this a feature or a bug? (Should we support this syntax in
> phpDocumentor, or might it change in php 5?)
>
It's a feature, and it ain't goin' nowhere.

---

## #619 — John Coggeshall — 2003-04-03T02:06:41+00:00

URL: https://externals.io/message/580#619 · In reply to: #580

I just checked out a copy of HEAD and can't build PHP5, it looks like
some changes were made to rename everything from php4->php5 and there
are still some php4 references floating around that end up in the
Makefile:

[php@localhost ~/php5]$ make
make: *** No rule to make target `libphp4.la', needed by `all'.  Stop.

Looking in the MakeFile one of the problems is OVERALL_TARGET (which
points to libphp4.la instead of libphp5.la) but changing that alone
isn't fixing it. Since I am sure there are those who know the build
system better than I maybe someone else could look at it.

John


-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~-
John Coggeshall
john at coggeshall dot org                  http://www.coggeshall.org/
-~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~--~=~
