A friend showed me this puzzling code the other day.
Can you guess the output?
1 | [22:11:41 mburke]$ php -a |
If you guessed PHP Fatal error: Function name must be a string
you would be wrong. PHP seldom does what you would expect.
Nope, its:
1 | object(Test)#2 (0) { |
I’m having a hard time imagining a situation where this behavior could be useful. I suppose it gives you a brand new default instance of an unknown class. Unless of course the constructor had required parameters. Then who knows what comes out of it!
PHP is not a sane language.