Skip to content

Instantly share code, notes, and snippets.

@iakio
Created June 2, 2012 08:32
Show Gist options
  • Save iakio/2857336 to your computer and use it in GitHub Desktop.
Save iakio/2857336 to your computer and use it in GitHub Desktop.
<?php
error_reporting(E_ALL | E_STRICT);
class C
{
public static $one = 1;
public $two = 2;
static function a() { echo "a\n"; }
function b() { echo "b\n"; }
}
$c = new C;
$c->a();
$c->b();
C::a();
C::b(); // <-- PHP Strict standards: Non-static method C::b() should not be called statically
echo $c->one, "\n"; // <-- PHP Strict standards: Accessing static property C::$one as non static
echo $c->two, "\n";
echo C::$one, "\n";
echo C::$two, "\n"; // <-- PHP Fatal error: Access to undeclared static property: C::$two
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment