It depends how you want to count the 'clicks', there are two possible ways:
The PHP Way
Because PHP is server-side, it requires the page to be reloaded everytime a function has to take place, basically you can't execute PHP after the page has loaded. This is what hen3rz is saying; If you choose to use PHP you'll need to reload the page with a variable set in the URL, and then use the $_GET[] function to check if the variable is set, and then add 1 to $x. (Thus saying that someone has clicked the link)
The JavaScript Way
Because JavaScript is client-side, functions can take place 'live', meaning the page doesn't have to be reloaded everytime a function needs to take place. This could simply be done by assigning a JS function to a button on the given page, and then adding 1 to var x everytime the button is pressed.
