Title: echo PHP within PHP?
Last modified: August 19, 2016

---

# echo PHP within PHP?

 *  [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/)
 * I am not good with PHP but I am learning…. quick question. Why can’t I echo PHP
   within a PHP tag?
 * Here is what I am trying to do… but it’s not working:
 *     ```
       <?php
       function my_super_admin_widget() {
       global $blog_id;
       if( $blog_id == '42' ) {
       echo '<?php if (function_exists('easing_slider')){ easing_slider(); }; ?>'; }
       }
       ?>
       ```
   
 * Thanks for your help!

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/echo-php-within-php/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/echo-php-within-php/page/2/?output_format=md)

 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778865)
 * try this instead:
 *     ```
       if( $blog_id == '42'  &&  function_exists('easing_slider') ) {
       echo easing_slider();
       }
       ```
   
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778867)
 * that worked like a charm!!! Thanks so much Rich! Mucho mucho appreciated!!
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778870)
 * I am getting this showing up in the admin panel however….
 *  header information – headers already sent by (output started at /home/mysite/
   public_html/wp-content/mu-plugins/sponsor_ad_widget.php:13) in /home/mysite/public_html/
   wp-includes/functions.php on line 830
 * Warning: Cannot modify header information – headers already sent by (output started
   at /home/mysite/public_html/wp-content/mu-plugins/sponsor_ad_widget.php:13) in/
   home/mysite/public_html/wp-includes/functions.php on line 831
 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778872)
 * then you probably have a ‘space’ in the functions file before an opening <?php
 * anr/or an error in your php code.
 * and no don’t post it here use [http://wordpress.pastebin.ca](http://wordpress.pastebin.ca)
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778875)
 * [http://wordpress.pastebin.ca/1997386](http://wordpress.pastebin.ca/1997386)
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778884)
 * See what my error would be? I am not catching it…
 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778897)
 * the error is probably in this file:
    wp-content/mu-plugins/sponsor_ad_widget.
   php
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778903)
 * So this is the code I have in that file now, based on what you recommended:
 *     ```
       <?php
       function my_super_admin_widget() {
       global $blog_id;
       if( $blog_id == '42'  &&  function_exists('easing_slider') ) {
       echo easing_slider(); }
       if( $blog_id == '999' ) {
       echo 'stuff goes here too'; }
       }
       ?>
       ```
   
 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778911)
 * can’t see anything wrong there, are you sure there are no extras lines before,
   or after the php opening/closing tags?
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778930)
 * Hmmm…. not sure? You saw both the files right?
 * What opening/closing tags are you referring to?
 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778936)
 * `<?php ... ?>`
 * and there is nothing else in there?
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778943)
 * Nothing more than what you see in the 2 files… [:/)
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778946)
 * You may not be able to see trailing spaces. Try following the instructions in
   [this Codex page](http://codex.wordpress.org/FAQ_Troubleshooting#How_do_I_solve_the_Headers_already_sent_warning_problem.3F)
   on those 2 files.
 *  Thread Starter [bwinn](https://wordpress.org/support/users/bwinn/)
 * (@bwinn)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778951)
 * What the… I haven’t even made any changes and it’s bringing up this error now…
 * “Warning: Cannot modify header information – headers already sent by (output 
   started at /home/mysite/public_html/wp-content/mu-plugins/sponsor_ad_widget.php:
   12) in /home/mysite/public_html/wp-includes/pluggable.php on line 890”
 * I looked at pluggable.php and it doesn’t even have 890 lines of code. I am stumped!
 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/#post-1778959)
 * The issue is in sponsor_ad_widget.php

Viewing 15 replies - 1 through 15 (of 17 total)

1 [2](https://wordpress.org/support/topic/echo-php-within-php/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/echo-php-within-php/page/2/?output_format=md)

The topic ‘echo PHP within PHP?’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 17 replies
 * 3 participants
 * Last reply from: [bwinn](https://wordpress.org/support/users/bwinn/)
 * Last activity: [15 years, 4 months ago](https://wordpress.org/support/topic/echo-php-within-php/page/2/#post-1778962)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
