Can you write javascript inside php?

I’m just starting to learn php, but familiar with asp.

I need to write this script to embed a flash file


<script type="text/javascript">

        var fo = new SWFObject("viewer.swf", "viewer", "100%", "100%", "7", "#181818");    

        fo.addVariable("preloaderColor", "0xffffff");

        fo.addVariable("xmlDataPath", "gallery.xml");    

        fo.write("flashcontent");    

    </script>    

The reason I wish to write this in PHP is that I want the


"gallery.xml"

to be a number that will keep changing depending on what link is selected based on a query from the link

if name.php?id=138 is selected, then the xml file to be used is 138.xml

Is this possible?