If you really want to execute a php script by clicking on the link you can use jquery ajax.
In your case call the same php file where the function is located by listening to the button's click event and perform the ajax request:
$('.sample-button').click(function() {
// Ajax Call
$.ajax({
url: "/path_to_your_script.php",
contentType: "application/x-www-form-urlencoded",
type: "POST",
data: {callFunction:true},
success: function(response){
// Check your response
},
error: function(){
// Error handling
}
});
});
On top of your php script you need to check:
<?php
if (!empty($_POST['callFunction'])) {
your_function() {
return $yourResponse;
}
exit();
}