(PLEASE GUYS HELP ME !!) Type "B" Residence permit for students

Hey Guys ! How are you  :),  Just a question please. i'm an egyptian, could you please tell me if I came
to Belgium to study for five years on a long term student visa "type D" (obtaining a
bachelor's degree and then a master's degree), would these five years be
regarded as a legal uninterrupted residency ? and if so can I apply for a
permanent resident card (type B) after these five years ? for the process of obtaining Belgium citizenship, regardless if i work or not as i heard somewhere that your credits transform into working
hours or something like that, so just any kind of advice would be so more than
appreciated, thanks you.

Time of stay on touristic visa is not taken into account. To get residence permit you have not only stay legally but also work on economy. 5 Years of studying on student visa is not countable completely. After that you have to find a job and work some period of time.