K
K
koliane2018-03-19 18:17:36
PHP
koliane, 2018-03-19 18:17:36

Is it possible in php to know that the called class method is the last one in the call chain?

Example:

class Example {
    public turnLeft(){
        //поворот налево
    }
    public turnRight(){
        //поворот направо
    }
}
$a = new Example();
$a->turnLeft()->turnLeft()->turnRight();

Is it possible inside the turnLeft() and turnRight() methods to determine if they are the last in the call chain? In this example, the last one is turnRight(). If, for example, the method is the last one, then you need to executeecho 'last method';

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question