Learning Mode
Zend PHP 5.3 Certification Exam
Object Oriented Programming
PHP Basics
Functions and Arrays
Security
Data Format & Types
Strings and Patterns
Databases and SQL
Web Features
INPUT/OUTPUT
Basics 1
Arrays 1
Strings 1
Web Features 1
70 Questions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
Question 15/34
Which of the following options shows the correct format of fetching class variables using the $this variable?
$this.$varname
$this.varname
$this->varname
$this->$varname
Explanation:
Answer option C is correct.
The $this variable refers to the properties of the same class. It cannot be used outside of a class. The $this variable is used to access variables inside the same class. The format for using the $this variable is as follows:
$this
->
varname
where, varname is a variable inside the class.
Answer options B, D, and A are incorrect. These are not valid formats of using the $this operator.
Solve it
Back
Next