Title: globals?
Last modified: August 22, 2016

---

# globals?

 *  Resolved [wahoofive](https://wordpress.org/support/users/wahoofive/)
 * (@wahoofive)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/globals/)
 * The “global” keyword doesn’t seem to work.
 *     ```
       [insert_php]
       $name = 'Mary';
       function showName()
       {
       	global $name;
       	 echo 'My name is ' . $name;
       }
       showName();
       [/insert_php]
       ```
   
 * This just prints “My name is”. In this simple case, I could pass the name as 
   a parameter, but if it’s a large variable and I’m calling the function numerous
   times it’s pretty inefficient.
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [WillBontrager](https://wordpress.org/support/users/willbontrager/)
 * (@willbontrager)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/globals/#post-5657372)
 * I guess inefficient depends on point of view.
 * Insert PHP works by processing the code between the tags through the PHP eval()
   function. It does have limitations. eval() isn’t a full-fledged PHP processor.
 * A couple more limitations are listed at the Insert PHP instruction page, which
   you’ll want to be aware of if you plan to continue using Insert PHP:
 * [http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php](http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php)
 * Will
 *  Thread Starter [wahoofive](https://wordpress.org/support/users/wahoofive/)
 * (@wahoofive)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/globals/#post-5657379)
 * Okay, thanks. I can always pass a large variable by reference.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘globals?’ is closed to new replies.

 * ![](https://ps.w.org/insert-php/assets/icon-256x256.gif?rev=3523853)
 * [Woody Code Snippets – Insert PHP, CSS, JS, and Header/Footer Scripts](https://wordpress.org/plugins/insert-php/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/insert-php/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/insert-php/)
 * [Active Topics](https://wordpress.org/support/plugin/insert-php/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/insert-php/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/insert-php/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [wahoofive](https://wordpress.org/support/users/wahoofive/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/globals/#post-5657379)
 * Status: resolved