Skip to content

Instantly share code, notes, and snippets.

@greut
Created November 19, 2011 09:57
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 greut/1378671 to your computer and use it in GitHub Desktop.
Save greut/1378671 to your computer and use it in GitHub Desktop.
<?php
class DemoClass {
public static $myvar;
public function __construct() {
$this::$myvar = "hello world : ";
}
public function getMyVar() {
echo $this::$myvar;
}
}
class Demo2Class extends DemoClass {
public function __construct() {
$this::$myvar = "goodbye world : ";
}
}
$demo1 = new DemoClass();
$demo1->getMyVar();
$demo2 = new Demo2Class();
$demo2->getMyVar();
$demo1->getMyVar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment