funcions using get/post/session/array

From: Frankenstein (sparmmonkey_at_yahoo.com)
Date: 10/05/04


Date: 5 Oct 2004 11:03:53 -0700

I'm trying to move away from counting on register globals. What would
be the ideal way to make generic funcions that could be used with
$_GET and $_POST and the like. Passing a lot of variables while
calling a function seems very cumbersome to me.

What do you think of the a solution like the following? Can you
suggest something better?

//A function that takes a reference to an array
function f(&$vars) {
        $var1 = $vars['var1'];
        $var2 = $vars['var2'];
}

f($_GET); //function call using get
f($_POST); //function call using get
$con['var1'] = 'yes';
$con['var2'] = 'no';
f($con); //function call using manually created array



Relevant Pages

  • Re: The inaugural VB6 vs dot net test
    ... If you do Command1 first, ... Command2 operates on an array that already has been ... way than counting up loops. ...
    (microsoft.public.vb.general.discussion)
  • Re: sort algorithm
    ... To output the sorted list, just dump the counts array. ... distribution counting into bins took: ...
    (comp.programming)
  • Re: Using size_t clearly (appropriately?)
    ... a justification for using 'size_t' to represent array indices. ... designed to count the number of elements in an array of struct foobar. ... In general case 'size_t' is not applicable for counting objects at all. ... In general case it's range is not sufficient (16-bit platform again). ...
    (comp.lang.c)
  • Re: Using size_t clearly (appropriately?)
    ... a justification for using 'size_t' to represent array indices. ... designed to count the number of elements in an array of struct foobar. ... size_t has *at least* enough range for the purpose. ... If the language had a type to be used generically for counting ...
    (comp.lang.c)
  • Re: 0 based collections
    ... Visual Basic has in my opinion taken the right approach that counting start ... Zero other than Null. ... However, almost every collection and array in VBNet starts at Zero, with the ...
    (microsoft.public.dotnet.languages.vb)