I think it would depend on the nature of your PhD. It would be very difficult to fit something lab-based around a foundation job, as you'd be needed at work during most daytime hours, when most labs are open, except when on nights etc. If you were doing something more library/literature/computer-based, it might be more feasible.
It's far more common to take specific time out of training for a PhD though, either as part of an AFP/ACF or just as time out of training, often doing some locum work to earn a bit of extra money.