Re[2]: [PHP] Skipping function arguments!
| From: | Richard Davey | Date: | Thu, 28 Apr 2005 14:42:20 +0000 |
| Subject: | Re[2]: [PHP] Skipping function arguments! | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-214098@lists.php.net to get a copy of this message | ||
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