Reply to Re[2]: [PHP] Skipping function arguments!

Your name:

Reply:


Posted by Richard Davey on 04/28/05 17:42

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

[Back to original 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

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