I started to look at it but decided it was just too ugly. My biggest hint that this was a very poor design is in your column names: registac and registan
You need to use column names that make sense by looking at them, not by looking at them then consulting an oracle.
Per many standards, variable names (and this goes very well for column names) should be unique within the first six characters. In the above example we have to dig 8 chars deep to find a difference.
$cognome and $nome make no sense at all and wregista and regista having a different first letter but one exploding into another is crap. Write your code in your native language and use caps to seperate words.
WRegIsTa, were the variable to make sense in the first place, would help. $WindowsRegistryIsTotalAsswipe is a much better variable name.
Also, never modify your iterator in an evaluation...do it on it's own line to make it more clear when the iterator is moved to the next value.