Title: PHP code in Adsense Plugin
Last modified: August 18, 2016

---

# PHP code in Adsense Plugin

 *  [what7](https://wordpress.org/support/users/what7/)
 * (@what7)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-code-in-adsense-plugin/)
 * Aloha,
 * I have added Phil Hord’s [Adsense plugin](http://www.philhord.com/phord/adsense-inline-with-wordpress-blog-posts-43.htm)
   to my new blog and would like to use it to display random ads from Adsense and
   others.
 * I’m thinking that I should be able to add some PHP code to the Adsense section
   in the plugin file, but it doesn’t want to execute my code 🙁
 * I have added the following code:
    `$adsense_code = ' <!-- Begin Google Adsense
   code --> CODE1 <phpcode> <?php srand(time()); $random = (rand()%9); print("Random
   is: $random"); CODE2 ?> </phpcode> <!-- End Google Adsense code --> ';
 * This displays CODE1 in my posts, but not the random number and CODE2. I have 
   installed [PHP Exec](http://priyadi.net/) in my attempt to make it work, but 
   that didn’t change anything.
 * Thanks,
    PhiMix

The topic ‘PHP code in Adsense Plugin’ is closed to new replies.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 0 replies
 * 1 participant
 * Last reply from: [what7](https://wordpress.org/support/users/what7/)
 * Last activity: [20 years, 1 month ago](https://wordpress.org/support/topic/php-code-in-adsense-plugin/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
