Created
May 2, 2013 23:44
-
-
Save Burakhan/5506306 to your computer and use it in GitHub Desktop.
__toString && __call
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 | |
class example { | |
const val = "print value"; | |
public function __toString(){ | |
return self::val; | |
} | |
public function __call($name,$arr){ | |
echo "There is no method called {$name}"; | |
} | |
} | |
$exam = new example(); | |
echo $exam; // "print value" | |
$exam->s(); //"There is no method called {$name}"; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment