Re: array indexes as arguments to a function
| From: | Aidan Lister | Date: | Tue, 13 Jul 2004 10:53:33 +0000 |
| Subject: | Re: array indexes as arguments to a function | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-190334@lists.php.net to get a copy of this message | ||
I don't understand what you're asking.
If you want to return a portion of an array, simple return the element
holding it.
In your example:
POST["var1_arr"]["dim1"]["dim2"]
return var1_arr;
Will return whatever lives in var1_arr.
Have a play around, you can see what a variable contains using print_r()
"Dennis Gearon" <gearond@fireserve.net> wrote in message
news:40F306F9.504@fireserve.net...
> please CC me, as I am on digest.
> -------------------------------------------------------------------
> say I've got a class that stores the cookie/get/post vars.
> I want to retrieve say one of them.
> Say, that post vars come back from browser as:
>
> POST["var1_arr"]["dim1"]["dim2"]
>
> they are stored in
>
> object->post_vars["var1_arr"]["dim1"]["dim2"];
> object->post_vars["singleton"];
>
> I have the function
>
> class->get_post_var($index_arr){
> return correct, processed post var;
> }
>
>
> How can I get the function to return an arbitrary depth into the post
> vars array?
> i.e. EITHER
>
> return $this->class_user_input_processing_function(
> $this->post_vars, $index_arr);
>
> Where $index_arr contains either:
>
> $index_arr = array("var1_arr","dim1_value", "dim2_value");
> -or-
> $index_arr = array("singleton");