Re[2]: Skipping function arguments!

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

 



Hello Jason,

Thursday, April 28, 2005, 3:25:10 PM, you wrote:

JB> <?php
JB> /** Page called with ?a=22 appended to URL */

JB> function add($a,$b,$c) {
JB>    return $a+$b+$c;
JB> }

JB> $total = add($first, $second, $third);
JB> /** You think this will be 0, but with register_globals this is actually
JB> 22 */
JB> echo $total;

As that code stands, even with register globals on, it will not echo
22. At least on PHP 4.3.11 on my server this is the case. I guess RG
makes all variables global, but not super-global, which leaves the
above safe as the null of $total overrides whatever may have been set.

Best regards,

Richard Davey
-- 
 http://www.launchcode.co.uk - PHP Development Services
 "I do not fear computers. I fear the lack of them." - Isaac Asimov

-- 
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