It's on a game-by-game basis, PSN still works in general since Sony doesn't seem to know what it means to discontinue online services, but when a company hosted the servers rather than have Sony do it for them, it's up to them to shut them down once the game gets too old. For example, Test Drive Unlimited's servers were shut down 5 years after release or LBP's servers I think was two years ago and so on, while other games like Monster Hunter (literally ALL of them) have their servers up and working still just fine!