Created
February 26, 2017 13:41
-
-
Save ilhamarrouf/431f5a66ecddf6adb8ae49155bdcbc33 to your computer and use it in GitHub Desktop.
OOP PHP
This file contains hidden or 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 | |
class MethodTest | |
{ | |
public function __call($name, $arguments) | |
{ | |
// Note: value dari $name adalah case sensitive. | |
echo "Memanggil method '$name' " | |
. implode(', ', $arguments). "<br/>"; | |
} | |
public static function __callStatic($name, $arguments) | |
{ | |
// Note: value dari $name adalah case sensitive. | |
echo "Memanggil method '$name' " | |
. implode(', ', $arguments). "<br/>"; | |
} | |
} | |
$obj = new MethodTest; | |
$obj->Jalankan('->pada konteks Object'); | |
MethodTest::Jalankan('->pada konteks Static'); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment