method chained in class with static methods

0

Good afternoon everyone! How do I create a chained method, being it a static method? example:

  

echo class :: meumétodo-> variable;

Thank you

    
asked by anonymous 30.01.2018 / 16:25

1 answer

0

Copy this and paste it and see how it works, go for the tests.

class Test
{
    public static $attr = "Hello";
    public static function testa(){
        echo "Olá eu sou o testa";
        return new static();
    }
}
$ola = Test::testa()::$attr;
var_dump($ola);

The new static() returns the class Test

    
30.01.2018 / 16:48