Hi Comex
Thanks! That worked! Robet you almost had it but missing the $key in
$newvalue[$key].
- Original Message -
From: "Comex" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, October 08, 2004 8:05 PM
Subject: Re: [PHP] Recursion to sanitize
foreach ( $userInput as $key => $value )
{
$newvalue[$key] = sanitize( $value );
}
return $newvalue;
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
this would probably be even better:
foreach ( $userInput as $key => $value )
{
$newvalue[$key] = sanitize( $value ); // reassign key with
sanatized value
}
return $newvalue // return array with sanatized $key => $value pairs
}
else
My 2 cents:
--
PHP General Mailing
it should be this i think:
foreach ( $userInput as $key => $value )
{
$newvalue[] = sanitize( $value );
}
return $newvalue // returns an array - since this is the only
way to get all veriables from the function
}
else
I could be wrong but the only way it woul
* Thus wrote Yoed Anis:
> Simple your code should look like this:
>
> ...
> if ( is_array($userInput) )
> {
> foreach ( $userInput as $key => $value )
> {
> return sanitize( $value ); //< needed to return it or
> else its not recurssive
This is wrong, o
Simple your code should look like this:
...
if ( is_array($userInput) )
{
foreach ( $userInput as $key => $value )
{
return sanitize( $value ); //< needed to return it or
else its not recurssive
}
}
else
{
...
.
Should work, not tes
6 matches
Mail list logo