PHP可以在执行之前编辑javascript代码

Is it possible to edit javascript code so that before it executes on page load I can inject few code changes through PHP. I want to use PHP so that changes happen on the server before page is loaded onto client side.

For example, this is what I have:

<script>
    video38.addParm("<param name='FlashVars' value='file=abc&fullscreen=true&width=440&height=241&'>")
</script>

And this is what I want:

<script>
    video38.addParm("<param name='FlashVars' value='file=abc&fullscreen=true&width=440&height=241&oneMoreParameter=paramValue'>")
</script>

I tried this with jquery but because this is flash, once it is loaded then adding parameter doesn't do anything. That's why I thought doing it in PHP because it executes on server side.

Any help on this will be great. Thanks!

        $ob = ob_start();
        //EXECUTE YOUR CODE HERE, THE PAGE AND STUFF e.g. include('./file.html');
        $pi = ob_get_contents();
        ob_end_clean();
        $js = <<<'EOD'
video38.addParm("<param name='FlashVars' value='file=abc&fullscreen=true&width=440&height=241&oneMoreParameter=paramValue'>");
EOD;
        $pi = preg_replace("@video38.addParm(.*?);@s", $js, $pi);
        echo $pi;

Take a look below:

<?php
  $test = 'test';
?>
<script type="text/javascript">
 var test = '<?php echo $test; ?>';
</script>

Hope, this will be helpful to you!