Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Exemplu
- {
- public function __call($functie, $parametri)
- {
- if (isset($this->$functie)) {
- return call_user_func_array($this->$functie, $parametri);
- }
- }
- // dupa ce ati verificat codul, incercati sa scoateti comentariul de pe functia urmatoare
- // si sa vedeti ce se intampla:
- /*
- public function functie_la_runtime(){
- echo "deja exist";
- }
- */
- }
- $ex = new Exemplu();
- $reflection = new ReflectionClass("Exemplu");
- $metode = $reflection->getMethods();
- if (!$reflection->hasMethod("functie_la_runtime"))
- {
- $ex->functie_la_runtime = function () {
- echo "Functie adaugata la runtime.<br />";
- };
- }
- $ex->functie_la_runtime();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement