Last active
August 29, 2015 14:00
-
-
Save georgestephanis/4a820a8df6a555951437 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
~ $ php testforben.php | |
Foo/__construct called successfully. | |
Foo/non_static called successfully. | |
Foo/is_static called successfully. | |
Foo/is_static called successfully. | |
Strict Standards: Non-static method Foo::non_static() should not be called statically in /Users/georgestephanis/testforben.php on line 25 | |
Foo/non_static called successfully. | |
~ $ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
error_reporting( E_ALL ); | |
class Foo { | |
function __construct() { | |
echo __CLASS__ . '/' . __FUNCTION__ . ' called successfully.' . "\r\n"; | |
} | |
function non_static() { | |
echo __CLASS__ . '/' . __FUNCTION__ . ' called successfully.' . "\r\n"; | |
} | |
public static function is_static() { | |
echo __CLASS__ . '/' . __FUNCTION__ . ' called successfully.' . "\r\n"; | |
} | |
} | |
$foo = new Foo(); | |
$foo->non_static(); | |
$foo->is_static(); | |
Foo::is_static(); | |
Foo::non_static(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment