Interview Questions

What is the use of $this->set(compact());

CakePHP Interview Questions and Answers


(Continued from previous question...)

What is the use of $this->set(compact());

Using $this->set(compact()) , we can pass multiple parameters to access into the view file.
For example,
$this->set(compact('posts','users','reports'));
Now all these variables will be available in respective view file.

(Continued on next question...)

Other Interview Questions