Which feature allows us to call more than one method or function of the class in single instruction?

Lò Ngọc

New member
Which feature allows us to call more than one method or function of the class in single instruction?
A. Typecasting
B. Method Including
C. Method adding
D. Method chaining
 
Answer: d
Explanation: When many methods are called in a single instruction in PHP, it is called method chaining. Following is a basic example of method chaining in php:
Code:
$a = new Order();
$a->CreateOrder()->sendOrderEmail()->createShipment();
 

Tìm kiếm

Back
Top