The US is the extreme in this regard. In the UK it's Bachelor's in 3 years, and then PhD in another 3 years, for most people. So six years in total. Some take another year to finish the PhD. I think many countries are similar, but I've even seen PhDs done in 2 years.
People in the US often think this isn't enough, but it's possible because we specialise much earlier. I started studying data structures and algorithms at 17 in what you would call high school, and we also were doing calculus at this stage. This was standard - not some kind of advanced placement. At 18 I was completely focused on computer science - no mandatory other courses except for maths. And at 21 I was writing papers and working towards the area I'd do my PhD research in. (I actually then took a really long break at this point, but you wouldn't have to.)