Well no, not exactly...onclick is a CLIENT side function...php is processed SERVER side...The page would have to be fully loaded in order for an onclick event to work properly which would mean php's functionality is already out of the picture. Now you could use an onclick function to say open a new window to run a php script...but you could not do something like
<input type="button" onclick="<? $var=5; ?>">
Note: This would not cause any kind of an error...it just wouldn't work