On Sat, July 14, 2007 8:09 am, Stut wrote:
Craige Leeder wrote:
1. Don't modify $_POST
Why not?
Other portions of a web application will too easily be confused by
what you've modified as the application grows.
Far better to have your clean data in a different array than to go
poking altered
Craige Leeder wrote:
1. Don't modify $_POST
Why not?
2. You controll the name of the array keys with the form. Why is there
any need to change them form PHP's side of things?
That's an assumption. A reasonable one in most cases, but not
necessarily the case.
3. I'm not sure Roberts
On Sat, 2007-07-14 at 01:57 -0400, Craige Leeder wrote:
3. I'm not sure Roberts solution would work. I think it might result
in an endless loop, and timeout your script.
It works fine.
Cheers,
Rob.
--
...
SwarmBuy.com -
On Sat, 2007-07-14 at 14:09 +0100, Stut wrote:
3. I'm not sure Roberts solution would work. I think it might result
in an endless loop, and timeout your script.
I always worry about adding or removing elements while iterating through
an array. I generally build up an array of keys to
Hello,
Is there any easy way to alter a key's name?
I would like to remove some underscores in the $_POST array keys.
Thanks,
OD
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
On Fri, 2007-07-13 at 15:36 -0500, OD wrote:
Hello,
Is there any easy way to alter a key's name?
I would like to remove some underscores in the $_POST array keys.
?php
foreach( $_POST as $key = $value )
{
if( strpos( $key, '_' ) !== false )
{
$_POST[str_replace( '_', '',
OD wrote:
Hello,
Is there any easy way to alter a key's name?
I would like to remove some underscores in the $_POST array keys.
Thanks,
OD
sure use str_replace in the value of the key name string.
But, that probably doesn't answer your question.
Why don't you supply us with an example of
On Fri, July 13, 2007 3:36 pm, OD wrote:
Hello,
Is there any easy way to alter a key's name?
I would like to remove some underscores in the $_POST array keys.
Not directly, but:
$post = array();
foreach($_POST as $k = $v){
$k = str_replace('_', ' ', $k);
$post[$k] = $v;
}
You could dink
1. Don't modify $_POST
2. You controll the name of the array keys with the form. Why is there
any need to change them form PHP's side of things?
3. I'm not sure Roberts solution would work. I think it might result
in an endless loop, and timeout your script.
- Craige
--
PHP General Mailing List
9 matches
Mail list logo