I have the following code:
class A { public function methodB() {
It should never work and it works on this machine! He really returns 1. Indeed, I swear I'm not drunk.
Of course, if I run it on my machine or on a production server, this will not work. Because you cannot call non-static methods like static. The class must first be created.
I was worried about that. Thought today, when I created a separate working machine for testing the project, I again got the environment in which this code works.
Everything is getting worse - I have developers on the team who still do not understand the difference between static and non-stationary methods. As a result, they have code that works fine on their machine, but it doesn't work in other environments.
WHY does it work? I want this code to fail. This should not work.
The configuration of the machine where it works is as follows:
vagrant @ vagrant-ubuntu-trusty-32: / var / www / apotheke $ php -v PHP 5.6.17-3 + deb.sury.org ~ trusty + 1 (cli) Copyright (c) 1997-2015 PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2015 Zend Technologies with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2015, Zend Technologies
Indeed, I feel so stupid. Did I miss something?
source share