ah i forgot e_all doesnt include e_strict. with error_reporting(-1 /
E_ALL | E_STRICT) i see the errors. so i think i am right that the use
of that special behavior of php is not a good idea. thank you guys!
Am 23.05.2011 00:32, schrieb Richard Quadling:
On 22 May 2011 22:44, Simon Hilz wrote
On 22 May 2011 22:44, Simon Hilz wrote:
> i cant reproduce that error. which php version do you use?
> i've coded an example for a "behavior"-pattern:
>
Try with ...
call
TankUpBehavior::tankUp (100)
Strict Standards: Non-static method TankUpBehavior::tankUp() should
not be called statically, as
i cant reproduce that error. which php version do you use?
i've coded an example for a "behavior"-pattern:
=
error_reporting(E_ALL & E_STRICT);
class Car {
private $fuel = 0;
private $drivenDistance = 0;
private $consumption =
class A {
public function b() {
echo get_class($this);
}
static function c() {
echo get_class($this);
}
}
class B {
public function test(){
A::b();
A::c();
}
}
$b = new B;
$b->test();
Generates:
Strict Standards: Non-static method A::b() sho
ourse I can call a method from it.
Sorry
Richard L. Buskirk
-Original Message-
From: Simon Hilz [mailto:simon.h...@gmx.de]
Sent: Sunday, May 22, 2011 11:56 AM
To: php-general@lists.php.net
Subject: Re: [PHP] context when calling non static method of class in a
static way
Richard,
yes!
]
Sent: Sunday, May 22, 2011 11:56 AM
To: php-general@lists.php.net
Subject: Re: [PHP] context when calling non static method of class in a
static way
Richard,
yes! at least my example works. i didn't test it any further; i doubt it
is intended that way.
Simon Hilz
Am 22.05.2011 16:42, schri
. Buskirk
-Original Message-
From: Simon Hilz [mailto:simon.h...@gmx.de]
Sent: Sunday, May 22, 2011 11:56 AM
To: php-general@lists.php.net
Subject: Re: [PHP] context when calling non static method of class in a
static way
Richard,
yes! at least my example works. i didn't test it any fu
Mike,
yes i know the difference. I actually discovered that by accident when
i've forgot to write the static keyword. my code lead to an exception. i
wondered about the details of that exception and came to the solution
that the behavior as decribed exists. in my opinion one could really use
Richard,
yes! at least my example works. i didn't test it any further; i doubt it
is intended that way.
Simon Hilz
Am 22.05.2011 16:42, schrieb ad...@buskirkgraphics.com:
Simon,
So without extending foo you can run bar in another class?
Richard L. Buskirk
-Original Message---
Simon,
So without extending foo you can run bar in another class?
Richard L. Buskirk
-Original Message-
From: Simon Hilz [mailto:simon.h...@gmx.de]
Sent: Sunday, May 22, 2011 10:18 AM
To: php-general@lists.php.net
Subject: [PHP] context when calling non static method of class i
Simon,
You may want to be careful with the way you declare your class methods.
Example:
public function bar() != static function bar(), even if you use
pnysudsfksdljfasdjfsd (::)
See the example below.
class Foo{
static function barStatic()
{
echo get_class($this);
}
11 matches
Mail list logo