----- Original Message ----- From: "Andrey Hristov" <[EMAIL PROTECTED]> To: "NTPT" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, October 21, 2002 6:16 PM Subject: Re: [PHP-DEV] Idea to extend language: Explicitly setting variable scope inside user defined function (longer)
> ----- Original Message ----- > From: "NTPT" <[EMAIL PROTECTED]> > To: "Andrey Hristov" <[EMAIL PROTECTED]>; "Marco Tabini" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Monday, October 21, 2002 7:14 PM > Subject: Re: [PHP-DEV] Idea to extend language: Explicitly setting variable > scope inside user defined function (longer) > > > > > > ----- Original Message ----- > > From: "Andrey Hristov" <[EMAIL PROTECTED]> > > To: "Marco Tabini" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]> > > Sent: Monday, October 21, 2002 12:42 PM > > Subject: Re: [PHP-DEV] Idea to extend language: Explicitly setting > variable > > scope inside user defined function (longer) > > > > > > > > > > > > > > Marco Tabini <[EMAIL PROTECTED]> wrote... : > > > > > > > > Well, you have to admit that the issue of variable scope is the first > > > > thing that hits someone who approaches PHP for the first time and > comes > > > > from other backgrounds, like C or ASP! > > > > > > > > > > For me global vars are bad at all. > > > If you want to use some value in a function then pass it to the function > > > even if you > > > want you can pass an array will variable ammount of vars that has names > as > > > indexes. > > > > Nice idea, i use it sometimes, it works, but ...... > > > > real life situation like this: > > > > <? > > $sqlstring=" UPDATE testtable SET > db_value1='$value_1',db_value1='$value_1' > > .....etc db_value_n='$value_n' "; > > > > // now you must produce $passed_variables array , like this > > > > > > // glue code > > $passed_variables['value_1']=$value_1; > > $passed_variables['value_2']=$value_2; > > > > . > > etc > > . > > $passed_variables['value_n']=$value_n; > > // end of glue code > > > > $result = db_query($passed_variables,$sqlstring) > > { > I don't use it like you show but > $result = db_query(array('value_1'=>$value_1, 'value_2'=>$value_2, > 'value_n'=>$value_n), $sqlstring); > > As you see there are no additional lines. You still need to construct an array, with take a processor time, and when you pass it to the function you still need to "unpack" it, this action take a processor time... you mean to use 'extract()' ? NTPT --- Odchozí zpráva neobsahuje viry. Zkontrolováno antivirovým systémem AVG (http://www.grisoft.cz). Verze: 6.0.401 / Virová báze: 226 - datum vydání: 9.10.2002 -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, visit: http://www.php.net/unsub.php