Maybe its a PHP miracle, as Ernest suggested.. maybe Rasmus or someone else on the PHP dev team has something to say about it, but it works.. maybe you all could use it :-D
Hopefully I didn't find a bug :-o
-J
Kevin Stone wrote:
It's probably working becuase you have register_globals = ON in your php.ini and those variable names are being set by default. Your posted code is actually doing nothing. What I can't figure is why you're not getting any errors. :-\ -Kevin----- Original Message ----- From: "Jason Young" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, November 06, 2002 12:13 PM Subject: Re: [PHP] Code AdviceHmm.. So then can anyone tell me why its working so far? ;) I am trying out every single function in this page in hopes to catch something, but so far I don't see any breakage - I can see there are a few ways to skin this cat.. the original code I posted DOES work.. I still may be blind to any future breakings.. that's why I posted it. Unfortunately, I'm getting responses saying that this code won't work at all - when it does.. :-/ Mike Ford wrote:-----Original Message----- From: Kevin Stone [mailto:kevin@;helpelf.com] Sent: 06 November 2002 18:50 To: [EMAIL PROTECTED] Subject: Re: [PHP] Code Advice All I have to go by is what I see. The method was this.. <? $get_allow = array('foo', 'bar', 'add', 'takeovertheworld'); while (list($key,$val)=each($get_allow)) { if (isset($_GET[$key])) $$key = $val; } ?> The array $get_allow has numerical indicies. Looping through that in the method described is going to set an integer to $key. So your first error is going to be that $_GET[0] is Undefined. Second error is going to be $$key is an invalid variable name.Mea culpa -- you're quite right, and I should read more carefully!(Well, it is 7pm and going home time....)This should, of course, be done like this: $get_allow = array(......); foreach ($get_allow as $key): if (isset($_GET($key)): $$key = $_GET[$key]; endif; endforeach; Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php