Add some code optimization

Added some code optimization to general function: !empty instead of sizeof $array > 0, precount variable outside for loops and  foreach($aHash as $key => $val);  instead of while(list($key,$val) = each($aHash));
This one too ;-) Thanks!