For instance I have a php function
<?php
function SayHi($msg){
return $msg;
}
?>
The following part triggers the onclick event
<a href="" onclick="">Click</a>
How can I merge the two such that when I click on Click, the php function is invoked..?
You can not. PHP is executed serverside, while javascript is executed clientside.
THe generic solution for this is to use asynchronous Javascript (ajax) to call on your webserver, which in turn can invoke PHP code to do various things.
jQuery is a very nice library to handle this, and much more.