WARNING: This procedure may have adverse side effects. You have been warned!
As the latest official version of PHP supported by Ubuntu 12.04 is 5.3.10, you need to add an external source for more recent versions. The source used is Dotdeb. "The packages from Dotdeb should work on Ubuntu, but no additional support will be provided." - http://www.dotdeb.org/about/
Add Dotdeb as package sources
$ sudo nano /etc/apt/sources.list and add:
deb http://php53.dotdeb.org squeeze alldeb-src http://php53.dotdeb.org squeeze all
Fetch Dotdeb GPG key
$ wget http://www.dotdeb.org/dotdeb.gpg
Install Dotdeb GPG key
$ cat dotdeb.gpg | sudo apt-key add -
Update package sources
$ sudo apt-get update
Upgrade packages and replace with new versions
$ sudo apt-get dist-upgrade