summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Zmievski <andrei@php.net>2001-12-07 06:19:20 +0000
committerAndrei Zmievski <andrei@php.net>2001-12-07 06:19:20 +0000
commit1ec143228a7c5d8b13c0b36d9ca6a732bfa49ac6 (patch)
tree87a461d19dd8709ad8e69079a1b9a49865e5a616
parent9a1f3b48a91c036debd392e1bd0c483a726e6410 (diff)
downloadphp-git-1ec143228a7c5d8b13c0b36d9ca6a732bfa49ac6.tar.gz
All right, let people RTFM.
-rw-r--r--ext/overload/README30
-rw-r--r--ext/overload/php_overload.h3
2 files changed, 26 insertions, 7 deletions
diff --git a/ext/overload/README b/ext/overload/README
index 06c22ad89e..e6017fe408 100644
--- a/ext/overload/README
+++ b/ext/overload/README
@@ -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.
diff --git a/ext/overload/php_overload.h b/ext/overload/php_overload.h
index 627f1ae9df..8b93452667 100644
--- a/ext/overload/php_overload.h
+++ b/ext/overload/php_overload.h
@@ -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);