1.

Which keyword is used to refer to properties or methods within the class itself?(a) private(b) public(c) protected(d) $thisThis question was posed to me in an interview for internship.This question is from Basics of Object-Oriented PHP- 2 in section Object-Oriented PHP of PHP

Answer»

Correct choice is (d) $this

Easy explanation: In PHP, the SELF and ‘this’ keyword are used to refer the class MEMBERS within the SCOPE of a class itself. The class members can be EITHER variables or functions.



Discussion

No Comment Found

Related InterviewSolutions