Hi Thomas
You can't do this in the way you understand it as PHP is a server-sided pre-processed language, therefore when it hits the browser, there is no trace of the PHP code left, just its result.
You could write a loop in PHP to generate multiple lines of HTML with javascript in them but you can't call a PHP function back from the browser, unless you do it as:
<code>
<a href="myscript.php?param1=param1value">Some Text</a>
</code>
If you outline your problem a little further and the result you want to achieve, I may be able to help a little further.
James