Re: [PHP] Recursion to sanitize user input

2004-10-08 Thread zooming
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

Re: [PHP] Recursion to sanitize user input

2004-10-08 Thread Comex
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

Re: [PHP] Recursion to sanitize user input

2004-10-08 Thread Robet Carson
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

Re: [PHP] Recursion to sanitize user input

2004-10-08 Thread Robet Carson
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

Re: [PHP] Recursion to sanitize user input

2004-10-08 Thread Curt Zirzow
* 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

RE: [PHP] Recursion to sanitize user input

2004-10-08 Thread 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 } } else { ... . Should work, not tes