Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ReactiveRaven/2775139 to your computer and use it in GitHub Desktop.
Save ReactiveRaven/2775139 to your computer and use it in GitHub Desktop.
scope issues
<?php
/***************
*
* My Wordpress plugin
*
*********************/
$myvar = "Hello";
function show_my_var(){
global $myvar;
echo "myvar = ".$myvar;
}
show_my_var();
/***************
*
* My Symfony controller
*
*********************/
class MyController {
public function myAction(){
include 'my-wordpress-plugin.php';
}
}
$c = new MyController();
$c->myAction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment