Iphone longevity?

Apple does iOS updates every so often but once an iphone gets older it can't run the newer systems. Starting from a new, current iphone like the 7 how long can an owner do updates. 2 years? Is android the same way?
2 answers 2