0

i want to use arrow function calling in php oop i use this in PDO and i don't know how to do it by myself

<?php 
class Test {
   public function funcA(){
       function funcB(){
           reuturn "hello world";
       }
   }
}
// how i can use this form in PHP OOP
$class->funcA()->funcB();

?>```
  • Why have you placed a function inside another function to begin with? It's rarely necessary and doesn't really fit with core OOP design principles. – ADyson Dec 28 '21 at 19:55
  • That's not how it works. – RobIII Dec 28 '21 at 19:55
  • Does this answer your question? [php oop call method from inside the method from the same class](https://stackoverflow.com/questions/6566729/php-oop-call-method-from-inside-the-method-from-the-same-class) – Jameu Lukasli1 Dec 28 '21 at 19:56
  • on PDO class you can use this $PDO->prepare($query)->execute(); i want to know how to do it like this – Giath Atrach Dec 28 '21 at 20:05
  • 1
    `public function a() { return $this; } public function b() { return $this; }; $foo->a()->b();` – Jared Farrish Dec 28 '21 at 20:27

0 Answers0