Re: context when calling non static method of class in a static way

From: Date: Sun, 22 May 2011 22:32:03 +0000
Subject: Re: context when calling non static method of class in a static way
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-313086@lists.php.net to get a copy of this message
On 22 May 2011 22:44, Simon Hilz <simon.hilz@gmx.de> wrote: > i cant reproduce that error. which php version do you use? > i've coded an example for a "behavior"-pattern: > Try with ... <?php error_reporting(-1); ini_set('display_errors', 1); class Car { ... I get output of ... Fuel of my new BMW with consumption 7.2l/100km: 0<br>call TankUpBehavior::tankUp (100)<br> Strict Standards: Non-static method TankUpBehavior::tankUp() should not be called statically, assuming $this from incompatible context in D:\Work\t1.php on line 50 Fuel after tank up 100 l: 100<br>call DriveBehavior::drive (24)<br> Strict Standards: Non-static method DriveBehavior::drive() should not be called statically, assuming $this from incompatible context in D:\Work\t1.php on line 50 Fuel after driving 24 km: 98.272<br> -- Richard Quadling Twitter : EE : Zend : PHPDoc @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY : bit.ly/lFnVea

« previous php.general (#313086) next »