Hi!

> class Cube {
>  function weird() {
>    echo Duck::foo();
>  }
>  
> }
> 
> class Duck {
>  public function foo() {
>      echo 'My class is: ' . get_class($this);
>  }
> }
> 
> $rubik = new Cube;
> $rubik->weird(); // Output:  My class is: Cube

This code produces:

Deprecated: Non-static method Duck::foo() should not be called
statically, assuming $this from incompatible context

which informs you about the fact that what you're doing is wrong. This
capability is kept for BC reasons. There was a discussion about dropping
this from PHP 7 but it wasn't yet decided to remove the support. In any
case, this has little to do with static and non-static functions having
different namespaces.

-- 
Stas Malyshev
smalys...@gmail.com

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to