If you have a Raspberry Pi 2 you will be have PHP 5.4 installed.
If you want to upgrade to PHP 5.6 or whatever is the latest version, you will have to download the source files, and compile the application.
This is not as difficult as it may sound.
In your Raspberry Pi SSH Terminal:
# Check the PHP version using the following command
# Get the PHP source
# First find the latest version number from the PHP download page: http://php.net/downloads.php
# Download the latest version either by downloading to your PC and then using ftp to save it back to the Raspberry Pi
# wget http://uk1.php.net/distributions/php-5.6.14.tar.bz2
# where 'uk1.php.net' is your to your nearest mirror. Find the mirror list here: http://php.net/mirrors.php.
# Once on the Raspberry Pi (the location does not really matter as you will delete the source files anyway) unpack using:
tar -xvjf php-5.6.14.tar.bz2
# Change directory to the source folder
# Find any updates
sudo apt-get update
# Get and install libxml2-dev which is a library that is used to manipulate xml files
sudo apt-get install libxml2-dev
# Do a configure
# If on the Raspberry Pi 2
# The process of compiling does take a long time on a Raspberry Pi - at least an hour for me.
# Install the application
sudo make install
# Reboot to make sure changes are effective
sudo shutdown - r now
# Check PHP version
# Delete the downloaded source files