Javascript of course. Php is server side, and so can't redo a page that is already loaded.
Just use onClick() function.
First create your images array:
var myImages = new Array('click.jpg','footballa.jpg','footballb.jpg','footballc.jpg');
Now write a function that does the image swap:
function swap(what) {
document.images['imageName'].src=what;
}
Note: You must have an image on the page named imageName, like this:
<img src='someimage.gif' name="imageName" />
This is the image that will be swapped each time a button is clicked.
Now call your function when button is clicked:
<input type=button onClick="swap(myImages[2])" value="view image">