I hate having to do this, but sometimes it has to be done. Here is how to get this middling PHP version onto this old version of Ubuntu.sudo add-apt-repository ppa:ondrej/php sudo apt update
I'm not sure that is the proper way to do it.
ppa are personal repositories - meaning someone put it together.
I think Ubuntu has offical backports, just like Debian.
In that case it would be better to get a the "newer" php version from the backport repository instead.
It looks like the ondrej/php repository is actually maintained by a Debian developer, Ondřej Surý. He is one of the package maintainers for the official debian and ubuntu php packages.