0
Good afternoon to all!!! How do I create a chained method, being it a static method? example:
echo class::mymethod->$variable;
Thank you
0
Good afternoon to all!!! How do I create a chained method, being it a static method? example:
echo class::mymethod->$variable;
Thank you
0
Copy this and glue and see how it works, keep doing 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
Browser other questions tagged php oop classes method
You are not signed in. Login or sign up in order to post.
define it as Static instead of putting public/private in the variable declares it in class as Static and calls class::meumetodo::$variable
– Marcos Brinner