If you have register_globals in php.ini turned on, then you can just use $profile. In PHP 4.2 and after, register_globals is turned off by default, for very good reason. Using register_globals creates the potential for serious security problems. I'll let you read the article documentation at Zend.com.

I really can't imagine why you'd want to use $profile instead. Aside from saving you a half-dozen keystrokes, it doesn't offer any benefit, and using $_GET['profile'] instead affords you the benefit of increasing code readability, as you can tell at a glance that it's not a regular variable but a variable passed from the browser.

First of all, if you're using dot-concatenation, why are you using double quotes? Double-quotes force PHP to parse everything in the string, but if you don't have any variables or escape-characters (e.g. "\n" or "\t") in it, then by using double quotes you're just forcing it to do unnecessary processing. In other words, using single-quotes when you can tends to be marginally faster.

Secondly, why are you recommending that the poster add parentheses around the argument for echo? To quote the documentation:

echo() is not actually a function (it is a language construct) so you are not required to use parentheses with it. In fact, if you want to pass more than one parameter to echo, you must not enclose the parameters within parentheses.

So parentheses is not the recommended usage and, in fact, it probably causes PHP to do an extra bit of unnecessary processing because it has to add another parenthese to the stack (the same is true for print, I believe). And using parentheses also keeps you from using the syntax echo $a, $b;, which I'm told is marginally faster than echo $a . $b;.

Anyway, sorry for all the questions. I was just curious about your recommendations.

Hi swirlee!
I'm don't know how about speed, but as i remember some advanced programmer use exactly double quotas :!:
examples?
Phorum Development Team http://www.phorum.orgFrancisco Burzi http://phpnuke.org

WiZARD wrote:Hi swirlee!I'm don't know how about speed, but as i remember some advanced programmer use exactly double quotas :!: examples?Phorum Development Team http://www.phorum.orgFrancisco Burzi http://phpnuke.org

Phorum and PHPNuke are indeed good pieces of software, but that doesn't mean that their code is optimal. Never assume that just because someone with a big or popular product does something one way that it's the best way to do it.