Deal of The Day! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Zend Exam 200-710 Topic 7 Question 35 Discussion

Actual exam question for Zend's 200-710 exam
Question #: 35
Topic #: 7
[All 200-710 Questions]

Which line of code can be used to replace the INSERT comment in order to output "hello"?

class C {

public $ello = 'ello';

public $c;

public $m;

function __construct($y) {

$this->c = static function($f) {

// INSERT LINE OF CODE HERE

};

$this->m = function() {

return "h";

};

}

}

$x = new C("h");

$f = $x->c;

echo $f($x->m);

Show Suggested Answer Hide Answer
Suggested Answer: B

Contribute your Thoughts:

Dana
1 months ago
Option B looks like the correct answer. We need to call the $f() function, which is assigned to $this->c, to get the desired output.
upvoted 0 times
Yes, that makes sense. We need to call the function assigned to $this->c.
upvoted 0 times
...
Justine
22 days ago
I think option B is correct. We should return $f() . 'ello'.
upvoted 0 times
...
...
Dong
1 months ago
Ha! Option D is clearly the way to go. I'm just going to return $y . 'ello' and hope the professor has a sense of humor.
upvoted 0 times
Shalon
8 days ago
User3: I'm not so sure about that, maybe we should consider the other options.
upvoted 0 times
...
Candra
13 days ago
User2: Yeah, I agree. Let's go with return $y . 'ello'.
upvoted 0 times
...
Vicky
28 days ago
User1: I think Option D is the correct one.
upvoted 0 times
...
...
Letha
2 months ago
Hmm, that's an interesting point. But I still think A) makes more sense because we need to access the method $this->m() to get 'h'.
upvoted 0 times
...
Wava
2 months ago
I'm going with Option C. Returning 'h' from $this->m() and concatenating it with $this->ello seems like the easiest way to get 'hello'.
upvoted 0 times
Isadora
26 days ago
I agree, Option C is the way to go. It's a simple and effective solution.
upvoted 0 times
...
Kirk
27 days ago
Option C is the correct choice. It combines 'h' from $this->m() with $this->ello to output 'hello'.
upvoted 0 times
...
...
Mary
2 months ago
Option A looks good to me. Concatenating the return value of $this->m() with 'ello' should output 'hello'.
upvoted 0 times
...
Lacresha
2 months ago
I disagree, I believe the correct answer is B) return $f() . 'ello'. We need to use the variable $f to output 'hello'.
upvoted 0 times
...
Letha
2 months ago
I think the answer is A) return $this->m() . 'ello'. It makes sense to concatenate 'h' from $this->m() with 'ello'.
upvoted 0 times
...

Save Cancel