|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2007-06-29 13:10 UTC] pollita@php.net
[2017-10-24 06:23 UTC] kalle@php.net
-Status: Assigned
+Status: Open
-Assigned To: pollita
+Assigned To:
[2017-10-24 23:01 UTC] kalle@php.net
-Package: operator
+Package: Scripting Engine problem
[2017-10-24 23:02 UTC] kalle@php.net
-Status: Open
+Status: Suspended
-Package: Scripting Engine problem
+Package: operator
[2017-10-24 23:02 UTC] kalle@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 16 17:00:02 2025 UTC |
Description: ------------ Hello, I love the extension. :) However, could __call possibly catch requests for non-declared overload methods? It would: * Help maintain the code brief * Consist with call_user_func behaviour * Say we overload methods within a class hierarchy and result of the overload yields an object of the original class. Cumulation of logic inside __call would save repeating the similar routine in each method: // calculating effect of the overload $class = get_class(); return new $class($result); Reproduce code: --------------- class Person { function __call($meth, $args) { switch(substr($meth, 2)) { case 'add': return 'Couple'; case 'sub': return 'Part'; } } } $john = new Person; echo $john + 1; Expected result: ---------------- Couple Actual result: -------------- Notice: Object of class Person could not be converted to int in C:\www\main\phppm\test.php on line 16 2