Are you talking about Photo Stream? If so, then iCloud only keeps the last 30 days or 1000 photos in the Photo Stream. Your phone may accumulate more Photo Stream photos than that over time, but when you turn off Photo Stream, and then re-enable it, iCloud pushes down what it has.
Photo Stream is not intended to be an archival or backup system. The function of Photo Stream is to provide a mechanism by which to share photos between devices that are signed onto the same iCloud account.
If you have been making an iCloud backup, then you will be able to restore any photos that were in your Camera Roll at the time of the backup to a new iOS device.
But you should always import your photos to a computer or back them up to a cloud service.
Is that what you were referring to?
Cheers,
GB