Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam 200-710 All Questions

View all questions & answers for the 200-710 exam

Exam 200-710 topic 1 question 30 discussion

Actual exam question from Zend's 200-710
Question #: 30
Topic #: 1
[All 200-710 Questions]

What is the output of the following code?

  • A. Fatal error: Access to private variable MyTrait: $abc from context MyClass
  • B. Notice: Undefined property MyClass: $abc
  • C. int(2)
  • D. int(3)
  • E. NULL
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
ZhukovPeter
4 years, 10 months ago
Program to check: <?php trait MyTrait { private $abc = 1; public function increment(){ $this->abc++; } public function getValue(){ return $this->abc; } } class MyClass { use MyTrait; public function incrementBy2(){ $this->increment(); $this->abc++; } } $c = new MyClass(); $c->incrementBy2(); var_dump($c->getValue()); Output: 3
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...