Skip to content

Instantly share code, notes, and snippets.

@devdave
Created June 22, 2011 16:37
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 devdave/1040493 to your computer and use it in GitHub Desktop.
Save devdave/1040493 to your computer and use it in GitHub Desktop.
I am in hell
<?php
class Parent {
public $auto_render = true;
public function after(){
echo ($this->auto_render ? "true" : "false"), \n;
}
}
class Child extends Parent {
function action_thing(){
$this->auto_render = false;
}
}
/**
execution path
$newInstance = new Child();
//auto_render = true
$newInstance->action_thing();
//Child::$auto_render = false WHILE Parent::$auto_render = true
$newInstance->after();
//True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment