php3-list | 199901
Date: 01/08/99
- Next message: Daniel Lashua: "Re: [PHP3] MySQL mysql_fetch_array function bug??"
- Previous message: Alessandro Grena: "[PHP3] I would create file in /etc/vmail..."
- In reply to: Harmony: "[PHP3] $HTTP_POST_VARS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Harmony-
Unfortunately, it does not work quite like this. Your POSTED variables
are set into the "namespace" when PHP Script Execution is started,
however, once it is going, PHP has no link between
$HTTP_POST_VARS["dog"] and $dog. It would be the same as me doing
array_walk($MY_OWN_ARRAY,'filter') and expecting that to change
something global.
I have never used array_walk, so I am not sure exactly how it works,
but, if you can (in your function) find out what index in the array is
being changed, then you could always set it as a global in your
function, then it would change like you want it to.
For Instance:
my_function filter ($in_str) {
# do something to in_str to make
# it different than it was before
$in_str .= " hi";
# find out the index in the array
# we are working with
$on = some_func_to_get_index($in_str);
# set the global value
$GLOBALS[$on] = $in_str;
return $in_str;
}
I don't think there is a way to get the index though... so your best bet
might be to write your own little array_walk function, so that you can
get the index.
Hope this helped,
Daniel
Harmony wrote:
>
> I want to pass all values of POST variables to a function
> before further action.
>
> i.e. my_function filter ($in_str) {
> $in_str = trim(ereg_replace....(.... ($in_str)));
> }
> $var_new_1 = my_function($var_old_1);
> $var_new_2 = my_function($var_old_2);
> $var_new_3 = my_function($var_old_3);
> ..
>
> I know $HTTP_POST_VARS (thanks to people who gave me hints).
>
> array_walk($HTTP_POST_VARS,'filter');
>
> The values of changed variables work only when called as:
> $HTTP_POST_VARS[var_new_1];
>
> but incorrect when called directly as $var_new_1
>
> WHY?
>
> What's the proper way for doing what I intended?
>
> Thanks a lot!
>
> Regards,
> harmony
>
> --
> PHP 3 Mailing List http://www.php.net/
> To unsubscribe send an empty message to php3-unsubscribe <email protected>
> To subscribe to the digest list: php3-digest-subscribe <email protected>
> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3
> List administrator: zeev <email protected>
-- PHP 3 Mailing List http://www.php.net/ To unsubscribe send an empty message to php3-unsubscribe <email protected> To subscribe to the digest list: php3-digest-subscribe <email protected> For help: php3-help <email protected> Archive: http://www.php.net/mailsearch.php3 List administrator: zeev <email protected>
- Next message: Daniel Lashua: "Re: [PHP3] MySQL mysql_fetch_array function bug??"
- Previous message: Alessandro Grena: "[PHP3] I would create file in /etc/vmail..."
- In reply to: Harmony: "[PHP3] $HTTP_POST_VARS"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

