Forum Moderators: coopster
I needed to clean arrays of data and set them as vars in the global scope, pass in an array and use this
$dataarr = array();
$dataarr['myvar1']= 12345;
$dataarr['myvar2']= 23456;
$dataarr['myvar3']= 34567;
$dataarr['myvar4']= 45678;
$dataarr['myvar5']= 56789;
$dataarr['myvar6']= 67890;
foreach ($dataarr as $key => $value) {
global ${$key};
${$key} = mysql_real_escape_string(strip_tags(trim($value)));
}
you could put whatever you want in the loop, anything that needs to happen to every piece
The old threads for your perusal
PHP Bag of Tricks I [webmasterworld.com]
PHP Bag of Tricks II [webmasterworld.com]
PHP Bag of Tricks III [webmasterworld.com]
Good PHP solutions to small problems [webmasterworld.com]