You are here: Re: How to pass array names to function parameters ? « PHP Programming Language « IT news, forums, messages
Re: How to pass array names to function parameters ?

Posted by tony on 04/15/06 23:43

In article <1145117876.799548.249800@v46g2000cwv.googlegroups.com>,
damirz@gmail.com says...
> Actually, you cannot use superglobal arrays as variable variables:
>
> >From PHP manual:
> http://www.php.net/manual/en/language.variables.predefined.php
>
> "Variable variables: Superglobals cannot be used as variable variables
> inside functions or class methods."
>
>

Oh bugger.

Thanks for that.

I was just trying to get all the superglobals to echo out to the browser
without having to code every one seperately...


something like:

function showthisarray($nextGlobal) {
echo($nextGlobal . "\n"); // debug line
foreach($nextGlobal as $k => $v ) {
echo($k . " = " . $v . "\n");
}
}

The idea being to just pass the array names in sequence or as selected.

The function does get the name of the relevant array as the first echo
prints it ok eg . $_GET or whatever as is passed into $nextGlobal

But the foreach() function just generates a bad parameter error.

I guess it will have to be the long winded solution.

tony

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация