MCQs > IT & Programming > PHP > In PHP5, what is the difference between using self and $this, and when is each appropriate?

PHP MCQs

In PHP5, what is the difference between using self and $this, and when is each appropriate?

Answer

Correct Answer: self is for use in static member functions to allow access to static member variables. $this is used in non-static member functions, and is a reference to the instance of the class on which the member function was called, but also allows access to static member functions.

Explanation:

Note: This Question is unanswered, help us to find answer for this one

PHP Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

PHP Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it