Below is a great article on getting your PHP to print out a javascript file and including it like any other javascript file. You basically just have to name the file something like “something.js.php” so that PHP knows to interpret the file. Then include it like a normal javascript file. In the something.js.php you can add a Header() function to make it render like a javascript file (include carriage returns).
www.givegoodweb.com/post/71/javascript-php