Dear candidates you will find MCQ questions of PHP here. Learn these questions and prepare yourself for coming examinations and interviews. You can check the right answer of any question by clicking on any option or by clicking view answer button.
Share your questions by clicking Add Question
Y
Q. What will be the output of the following PHP code?
<?php function uppercase($string) { echo ucwords($string); } $wow = "uppercase"; $wow("Time to live king size"); ?>
Y
Q. What will be the output of the following PHP code?
<?php function calc($num1, $num2) { $total = $num1 * $num2; } $result = calc(42, 0); echo $result; ?>
Y
Q. What will be the output of the following PHP code?
<?php function constant() { define("GREETING", "Welcome to Narnia",true); echo greeting; } ?>
Y
Q. What will be the output of the following PHP code?
<?php echo str_pad("Salad", 5)." is good."; ?>
Y
Q. What will be the output of the following PHP code?
<?php function colour() { $colors = array("red", "green", "blue", "yellow"); foreach ($colors as $value) { echo "$value <br>"; } } colour(); ?>
Y
Q. What will be the output of the following PHP code?
<?php function 2myfunc() { echo "Hello World"; } 2myfunc(); ?>
Y
Q. What will be the output of the following PHP code?
<?php function foo($msg) { echo "$msg"; } $var1 = "foo"; $var1("will this work"); ?>
Y
Q. What will be the output of the following PHP code?
<?php $user = array("Ashley", "Bale", "Shrek", "Blank"); for ($x=0; $x < count($user) - 1; $x++) { if ($user[$x++] == "Shrek") continue; printf ($user[$x]); } ?>
Y
Q. Within a namespace, for accessing the built-in PHP classes you can prefix the class name with a . . . . . and let PHP look in the global class list.
Y
Q. Which of the below namespace declaration is correct?
Don't have account? Register here.