per includerlo in una funzione PHP dovrei fare così ad occhio??

Codice PHP:

function scriptJS($nForm$nSelect$nTesto){
        echo 
"<script>\n";
        echo 
"<!--\n";
        echo 
"function JSscript(){";
        echo 
"document.".$nForm.".".$nTesto.".value=document.".$nForm.".".$nSelect.".[document.".$nForm.".".$nSelect.".selectedIndex].text";
        echo 
"return TRUE;";
        echo 
"}";
        echo 
"-->\n";
        echo 
"</script>\n";
    return 
TRUE;