]> granicus.if.org Git - php/commitdiff
All right, let people RTFM.
authorAndrei Zmievski <andrei@php.net>
Fri, 7 Dec 2001 06:19:20 +0000 (06:19 +0000)
committerAndrei Zmievski <andrei@php.net>
Fri, 7 Dec 2001 06:19:20 +0000 (06:19 +0000)
ext/overload/README
ext/overload/php_overload.h

index 06c22ad89e23330066d845e6d397b0b4ef373bdf..e6017fe40810e33acf05e64601449b7d34b50fdc 100644 (file)
@@ -16,10 +16,17 @@ properties normally.
 
 Usage
 -----
+<?php
+
 class OO {
     var $a = 111;
     var $elem = array('b' => 9, 'c' => 42);
 
+    function OO($aval = null)
+    {
+        $this->a = $aval;
+    }
+
     function __get($prop_name, &$prop_value)
     {
         if (isset($this->elem[$prop_name])) {
@@ -34,6 +41,20 @@ class OO {
         $this->elem[$prop_name] = $prop_value;
         return true;
     }
+
+    function __call()
+    {
+        $args = func_get_args();
+        $method = array_shift($args);
+        print '-- OO::' . $method . "() was called.--\n";
+        return call_user_func_array(array(&$this, 'my_' . $method), $args);
+    }
+
+    function my_whatever($f1, $f2, $f3)
+    {
+        var_dump($f1, $f2, $f3);
+        return $f1 + $f2;
+    }
 }
 
 overload('OO');
@@ -50,6 +71,9 @@ $val->prop = 555;
 $o->a = array($val);
 var_dump($o->a[0]->prop);
 
+var_dump($o->whatever(1, 2, 'a'));
+
+?>
 
 What works
 ----------
@@ -58,15 +82,13 @@ Whatever you can get it to do.
 
 What doesn't work
 -----------------
-__call() support.
 Invoking original overloading handlers, if the class had any.
 __set() only works to one level of property access, no chains yet
-Whatever I am forgetting about here.
+Whatever else I am forgetting about here.
 
 
 What might change
 -----------------
-Hell, anything, even the name of extension and its function.
-
+Hell, anything, even the name of extension and its only function.
 
 Feedback, please.
index 627f1ae9df8f376f9895759f9327d0338c044925..8b93452667134c83b40a18595da06f8a814a0bb3 100644 (file)
@@ -36,9 +36,6 @@ extern zend_module_entry overload_module_entry;
 #endif
 
 PHP_MINIT_FUNCTION(overload);
-PHP_MSHUTDOWN_FUNCTION(overload);
-PHP_RINIT_FUNCTION(overload);
-PHP_RSHUTDOWN_FUNCTION(overload);
 PHP_MINFO_FUNCTION(overload);
 
 PHP_FUNCTION(overload);