public
Created

  • Download Gist
derp.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
<?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();

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.