Upgrade to PHP 5.4 in Ubuntu / Debian

There are a few reasons to upgrade to PHP 5.4; mine was to escape XML data with PHP the proper way (using ENT_XML1) like so:
$string = htmlspecialchars($string, ENT_XML1, 'UTF-8');

To Install PHP version 5.4 on Ubuntu, you have to add the right PPA and reinstall your php packages:
sudo add-apt-repository ppa:ondrej/php5
sudo apt-get update 
sudo apt-get install php5-dev
You might need to install the add-apt-repository command first:
sudo apt-get install python-software-properties 
That should do it. Here's to the poor saps trying to write their own XML escape functions for PHP 5.3 and lower.