how to insert javascript as parameter into php function? : <p>i want to call php function inside javascript like this. i want value inside array r can be added to my_func() as parameter. but i get an error when do this.</p>

<pre><code>for(i=0;i&lt;r.length;i++){
    var distance = &lt;?php echo my_func(+r[i].coordinate+);?&gt;;
}
</code></pre>

<p>or</p>

<pre><code>for(i=0;i&lt;r.length;i++){
    var distance = &lt;?php echo my_func(?&gt;r[i].coordinate&lt;?php );?&gt;;
}
</code></pre>

<p>If any one have an idea to help I really appreciate it because I need it so much, and thanks to all.</p>
