Skip to content

Instantly share code, notes, and snippets.

@jrtashjian
Created April 20, 2012 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jrtashjian/2430498 to your computer and use it in GitHub Desktop.
Save jrtashjian/2430498 to your computer and use it in GitHub Desktop.
<?php
// OH GOD NO
$object = new ClassName();
class ClassName {
function method_one()
{
global $object;
$object->method_two();
}
function method_two()
{
global $object;
$object->another_method();
}
// ...
}
// Proper
$object = new ClassName();
class ClassName {
function method_one()
{
$this->method_two();
}
function method_two()
{
$this->another_method();
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment