Title: Does not work with provided example
Last modified: August 30, 2016

---

# Does not work with provided example

 *  Resolved [onyerleft](https://wordpress.org/support/users/onyerleft/)
 * (@onyerleft)
 * [10 years, 9 months ago](https://wordpress.org/support/topic/does-not-work-with-provided-example/)
 * I’ve copied your example into a code snippet verbatim:
 * global $PHPPC;
    $PHPPC->$_vars[“myvaridentifier”] = $myvar;
 * and get this when it’s added to page text:
 * Fatal error: Cannot access empty property in …/wp-content/plugins/php-code-for-
   posts/PHPPostCode.php(85) : eval()’d code on line 3
 * Bleh. Frustrating.
 * [https://wordpress.org/plugins/php-code-for-posts/](https://wordpress.org/plugins/php-code-for-posts/)

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

 *  [olidueggelin](https://wordpress.org/support/users/olidueggelin/)
 * (@olidueggelin)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/does-not-work-with-provided-example/#post-6476937)
 * Same problem here.
    Support please!
 *  Thread Starter [onyerleft](https://wordpress.org/support/users/onyerleft/)
 * (@onyerleft)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/does-not-work-with-provided-example/#post-6476938)
 * olidueggelin, try
 * [https://wordpress.org/plugins/insert-php/](https://wordpress.org/plugins/insert-php/)
 * Much more stable. Declare global every variable you use in page text.
 * There is one issue: single quotes don’t work. For example:
 * [insert_php]
    echo ‘Programmers ask, “Why can\’t I include PHP code in my pages?”‘;[/
   insert_php]`
 * will throw an error. Instead, use:
 * [insert_php]
    echo “Programmers ask, \”Why can’t I include PHP code in my pages?\””;[/
   insert_php]
 *  Plugin Author [Jamie Fraser](https://wordpress.org/support/users/thejfraser/)
 * (@thejfraser)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/does-not-work-with-provided-example/#post-6476956)
 * Hi Guys,
 * It’s a small typo in the readme 🙂
 * it should be either:
 *     ```
       global $PHPPC;
         $PHPPC::$_vars["myvaridentifier"] = $myvar;
       ```
   
 * OR
 *     ```
       global $PHPPC;
         $PHPPC->_vars["myvaridentifier"] = $myvar;
       ```
   
 * both work

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

The topic ‘Does not work with provided example’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/php-code-for-posts_0d1022.svg)
 * [PHP Code for posts](https://wordpress.org/plugins/php-code-for-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/php-code-for-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/php-code-for-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/php-code-for-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/php-code-for-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/php-code-for-posts/reviews/)

 * 3 replies
 * 3 participants
 * Last reply from: [Jamie Fraser](https://wordpress.org/support/users/thejfraser/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/does-not-work-with-provided-example/#post-6476956)
 * Status: resolved