I have tried this and it is confusing at first, anyway the best practice to insert the Google adsense code is to assign this to a PHP variable:
Example of adsense code:
<script type="text/javascript">
google_ad_client = "pub-123456789";
google_ad_slot = "123456";
google_ad_width = 180;
google_ad_height = 150;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
So to assign this code to a PHP variable and then outputting to an HTML:
<?php
//assign adsense code to a variable
$googleadsensecode = '
<script type="text/javascript">
google_ad_client = "pub-123456789";
google_ad_slot = "123456";
google_ad_width = 180;
google_ad_height = 150;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
//now outputting this to HTML
echo $googleadsensecode;
?>
What is good with this approach is that you will not be needing any PHP include or require functions which might be disabled in some free hosting accounts.
Related posts:
MySQL Avg - Using this average built in function in PHP and Database
PHP Web Application Design Flow and Analysis: Case Example
Tips to make your PHP website loads VERY fast
PHP Script to Backup MySQL database using Hosting Cron
Best practices of mysql_real_escape_string function in php
Learn PHP OOP (Object Oriented Programming) for Beginners Tutorial

thanks! it worked like a charm!
It worked perfectly.
Wow fantastic! I am looking forward for your success in using the script. Cheers,
Codex