Title: Shared variables
Last modified: February 5, 2019

---

# Shared variables

 *  Resolved [Flankerator](https://wordpress.org/support/users/flankerator/)
 * (@flankerator)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/shared-variables/)
 * Hello Alex,
    Very nice plugin, simple and does the job well.
 * When having multiples php instances that share same variable, i noticed that 
   I have to include same variable in each instance, so basically when updating 
   variables, I would have to do it in all instances every time.
 * Is there a way to have one instance where I update the variable and then it shares
   it across all instances that are posted on same page?
 * Example:
    <?php //master update here if($instance==”1″) { $date1=”2018-08-01″;
   $date2=”2017-11-01″; } if($instance==”2″) { echo $date1; } if($instance==”3″){
   echo $date2; }
 * ?>
    Many thanks.
 * Naim

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

 *  Plugin Author [Alex](https://wordpress.org/support/users/alexander_fuchs/)
 * (@alexander_fuchs)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/shared-variables/#post-11171048)
 * Hi Naim,
 * this should already work. You can just put rhe variable assignment outside of
   the instance.
 * Like this:
 * <?php
 * //master assignment here
    $text = ‘Hello word’; if($instance == “1”) { echo $
   text; } …
 * Let me know if it works for you.
 *  Thread Starter [Flankerator](https://wordpress.org/support/users/flankerator/)
 * (@flankerator)
 * [7 years, 3 months ago](https://wordpress.org/support/topic/shared-variables/#post-11173361)
 * It worked, thanks Alex!
 * the UI box is tiny to edit long code but i could copy paste back and forth between
   wp and a notepad.
 * Thanks
    Naim
    -  This reply was modified 7 years, 3 months ago by [Flankerator](https://wordpress.org/support/users/flankerator/).

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

The topic ‘Shared variables’ is closed to new replies.

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

 * 2 replies
 * 2 participants
 * Last reply from: [Flankerator](https://wordpress.org/support/users/flankerator/)
 * Last activity: [7 years, 3 months ago](https://wordpress.org/support/topic/shared-variables/#post-11173361)
 * Status: resolved