Your ads will be inserted here by
Easy AdSense.
Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.
I just found a nice (or lets say not so nice) unexpected behavior in PHP. Apparently anything goes with constructors.
Calling a constructor that hadn’t been defined did not throw any kind of exception, error, warning, whatsoever.
So the following example executes:
class TestClass { public function testFunction() { return "Hello World!"; } } $testClass = new TestClass ("blabla"); // should report an error echo $testClass->testFunction(); // Hello World |
Update: Apparently there is a rationale behind this: the PHP function func_get_arg()
allows shell style retrieval of function arguments.
Leave a Reply