fetch_all_by_available() as $value) { if(count($data[$value['idtype']]) < 8) { $keys[$value['idtype']] = $keys[$value['idtype']] ? ++$keys[$value['idtype']] : 1; $data[$value['idtype']][$keys[$value['idtype']]] = $value; } } savecache('click', $data); } ?>