|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull Requests |
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 02:00:01 2025 UTC |
Description: ------------ I am trying to write a class which can be used statically e.g. Db::connect(); Db::query() etc. I also have a __call() method to be executed in case of calling an inexistent static method. But this does not work: PHP says that the method is undefined. Reproduce code: --------------- <?php class Db { ... function __call($method,$args) { echo 'Method: '.$method.'<br />'; var_dump($args); } ... } # this works fine $Db = new Db(); $Db->test(); # this makes a PHP error Db::test(); ?> Expected result: ---------------- Method: test Array() Method: test Array() Actual result: -------------- Fatal error: Call to undefined method Db::test() in ...