Yes you can call a PHP function when you click on an HTML button.
You will have to use the onclick event listener in the button to call a Javascript function that will call the PHP function.
One thing to note though, if any variables are declared as GLOBAL in the PHP function, they must be assigned values before the Javascript function is parsed by the HTML interpreter.
Example of incorrect way to do it:
The above example will display an empty alert box.
Example of correct way to do it.
You could also use Javascript's AJAX to do an httpRequest to a PHP file to perform the PHP tasks and return the results.
But you can not call a PHP function directly from a button using the onclick event listener.
Because the event listeners in an HTML element, only communicate with Javascript.