ok i know how to execute a function through a link but is it possible to do it through a link on the same page? i.e
myfunction() { print("hello"); }
You are looking for client-side-- Javascript. PHP is server side and would require the page to reload.