cvs: php4 /ext/overload README php_overload.h

From: Date: Fri, 07 Dec 2001 06:19:20 +0000
Subject: cvs: php4 /ext/overload README php_overload.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-8496@lists.php.net to get a copy of this message
andrei Fri Dec 7 01:19:20 2001 EDT Modified files: /php4/ext/overload README php_overload.h Log: All right, let people RTFM. Index: php4/ext/overload/README diff -u php4/ext/overload/README:1.1 php4/ext/overload/README:1.2 --- php4/ext/overload/README:1.1 Mon Oct 15 16:32:56 2001 +++ php4/ext/overload/README Fri Dec 7 01:19:20 2001 @@ -16,10 +16,17 @@ 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 @@ $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 @@ $o->a = array($val); var_dump($o->a[0]->prop); +var_dump($o->whatever(1, 2, 'a')); + +?> What works ---------- @@ -58,15 +82,13 @@ 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: php4/ext/overload/php_overload.h diff -u php4/ext/overload/php_overload.h:1.1 php4/ext/overload/php_overload.h:1.2 --- php4/ext/overload/php_overload.h:1.1 Mon Oct 15 16:32:56 2001 +++ php4/ext/overload/php_overload.h Fri Dec 7 01:19:20 2001 @@ -36,9 +36,6 @@ #endif PHP_MINIT_FUNCTION(overload); -PHP_MSHUTDOWN_FUNCTION(overload); -PHP_RINIT_FUNCTION(overload); -PHP_RSHUTDOWN_FUNCTION(overload); PHP_MINFO_FUNCTION(overload); PHP_FUNCTION(overload);

« previous php.cvs (#8496) next »