Owners of iPhone, iPad, iPod, Mac, or Apple TV products can obtain service and parts from Apple service providers, including Apple Stores and independent repair providers, for a minimum of 5 years* starting from the last time Apple distributed the product for sale. We guarantee our service, including replacement parts, for 90 days or the remaining term of the Apple warranty or AppleCare plan, whichever is longer. This is in addition to the rights granted to you by consumer protection legislation. In answer to your question, neither Apple (nor any other manufacturer) will replace an out-of-warranty phone free of charge.
Take a look at it and see if Apple would give you any kind of discount. We can replace your iPhone battery for a service fee. Our warranty does not cover batteries that wear out from normal use. If you have AppleCare+ and the product's battery is less than 80 percent of its original capacity, you can replace the iPhone battery at no additional cost.