# PHP to move code to head

**URL:** <https://forum.kirupa.com/t/php-to-move-code-to-head/254867>\
**Category:** programming\
**Created:** [March 16, 2008, 5:02pm UTC](https://forum.kirupa.com/t/php-to-move-code-to-head/254867 "2008-03-16T17:02:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![bigbstanley](https://avatars.discourse-cdn.com/v4/letter/b/977dab/32.png) [@bigbstanley](https://forum.kirupa.com/u/bigbstanley)\
**Post date:** [March 16, 2008, 5:02pm UTC](https://forum.kirupa.com/t/php-to-move-code-to-head/254867/1 "2008-03-16T17:02:12Z")

</div>

Maybe there is a better solution to what I’m trying to do so any suggestions are appreciated. I am calling in some include files and on those files I have some javascript that needs to be moved to the head tags. The javascript is only specific to that include so I don’t want to have the javascript on every page and I don’t want to create a seperate js file for each function - just whenever that include page is called, to have the javascript for it in the head tags. I know in Coldfusion, you can send code/html/javascript to be moved to the head tags. Just not sure how to do this with PHP.

Thanx
