What will be the output of the following PHP 7.1 code snippet?
-
abstract class A_Class
{
abstract protected function name_P($name);
}
class Example extends A_Class
{
public function Name_P($name, $separator = ".") {
if ($name == "Mango") {
$product = "Fruit";
} elseif ($name == "Carrot") {
$product = "Vegitable";
} else {
$product ="";
}
return "{$name}{$separator} {$product}";
}
}
$class = new Example;
echo $class->Name_P("Mango"), "\n";
echo $class->Name_P("Carrot"), "\n";
?>
Correct Answer:
-Mango. Fruit
Carrot. Vegitable
Explanation:
Note: This Question is unanswered, help us to find answer for this one
More PHP 5 MCQ Questions