MCQs > IT & Programming > PHP > What will be the output of the following code? elements[] = ''; return $this; } public function input($type, $name, $value = ') { $this->elements[] = ''; return $this; } public function textarea($name, $value = ') { $this->elements[] = ''; return $this; } public function __toString() { return join('\n', $this->elements); } } $b = new FormBuilder(); echo $b->label('Name')->input('text', 'name')->textarea('message', 'My message');

PHP MCQs

What will be the output of the following code? <?php class FormBuilder { private $elements = array(); public function label($text) { $this->elements[] = "<label>$text</label>"; return $this; } public function input($type, $name, $value = '') { $this->elements[] = "<input type=\"$type\" name=\"$name\" value=\"$value\" />"; return $this; } public function textarea($name, $value = '') { $this->elements[] = "<textarea name=\"$name\">$value</textarea>"; return $this; } public function __toString() { return join("\n", $this->elements); } } $b = new FormBuilder(); echo $b->label('Name')->input('text', 'name')->textarea('message', 'My message');

Answer

Correct Answer: <label>Name</label> <input type="text" name="name" value="" /> <textarea name="message">My message</textarea>

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