|  | Posted by J.O. Aho on 08/03/05 07:32 
Pasquale wrote:> The snippet of code below is what I use at the top of my script to
 > declare and 'filter' my variables. I was going to put them in a seperate
 > file to make them portable and include them in other registrations. The
 > potential problem is if each team member has more than just 4 or 5
 > pieces of information, like say 20. If there are 10 members with 20
 > pieces of information, it can get long and repetitive.
 >
 > I just have a feeling there is a better way of doing this, correct? Can
 > classes be used? If so, an example would be appreciated. I'm trying to
 > use classes and whatever else I can to make my code better and cleaner,
 > so any other suggestions would also be appreciated.
 >
 > Thanks.
 >
 >
 > $stg1name = NameFilter($stg1name);
 > $stg1email = EmailFilter($stg1email);
 > $stg1gndr = Filter($stg1gndr);
 > $stg1age = NumberFilter($stg1age);
 > $stg1shirt = Filter($stg1shirt);
 >
 >
 > $stg2... to $stg9...
 >
 >
 > $stg10name = NameFilter($stg10name);
 > $stg10email = EmailFilter($stg10email);
 > $stg10gndr = Filter($stg10gndr);
 > $stg10age = NumberFilter($stg10age);
 > $stg10shirt = Filter($stg10shirt);
 >
 > <<snip>>
 >
 
 I wold use a array (arrays in array) to store data, where into I would push
 the data in a loop (for/while). Array has the advantage that you can use the
 count() to know how many elements you always have and then can make simple
 for-loops to  process the data.
 
 
 //Aho
 [Back to original message] |