<?php
$one = "Hello";
$two = "World";
echo two;
?>
Select an option to see the answer and solution.
Practice every MCQ with options. Use Show answers when you want the correct option and solution.
143
Questions
2/8
Page
Pick an option on a question to see the right answer and solution.
<?php
$one = "Hello";
$two = "World";
echo two;
?>
Select an option to see the answer and solution.
<?php
$one = "Hello";
$two = "World";
echo "two";
?>
Select an option to see the answer and solution.
<?php
$one = "Hello";
$two = "World";
echo "two";
?>
Select an option to see the answer and solution.
<?php
echo "This is India";
?>
Select an option to see the answer and solution.
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "My car is a {$cars[0]}";
?>
Select an option to see the answer and solution.
<?php
print "echo hello world";
?>
Select an option to see the answer and solution.
<?php
$one = 1;
print($one);
print $one;
?>
Select an option to see the answer and solution.
<?php
$cars = array("Volvo", "BMW", "Toyota");
print $cars[2];
?>
Select an option to see the answer and solution.
<?php
$one = "one";
$two = "two";
print(two);
?>
Select an option to see the answer and solution.
<?php
$one = "one";
$two = "two";
print(two);
?>
Select an option to see the answer and solution.
<?php
$one = "one";
$two = "two";
print("two");
?>
Select an option to see the answer and solution.
<?php
$one = "one";
$two = "two";
print(two);
?>
Select an option to see the answer and solution.
<?php
$one = "one";
$two = "one";
print(two);
?>
Select an option to see the answer and solution.
<?php
print("this"."was"."a"."bad"."idea");
?>
Select an option to see the answer and solution.
<?php
define("GREETING", "PHP is a scripting language");
echo $GREETING;
?>
Select an option to see the answer and solution.
<?php
class Constants
{
define('MIN_VALUE', '0.0');
define('MAX_VALUE', '1.0');
public static function getMinValue()
{
return self::MIN_VALUE;
}
public static function getMaxValue()
{
return self::MAX_VALUE;
}
}
echo Constants::getMinValue();
echo Constants::getMaxValue();
?>
Select an option to see the answer and solution.
<?php
define("__LINE__", "PHP is a scripting language");
echo __LINE__;
?>
Select an option to see the answer and solution.
<?php
define('IF', 42);
echo "IF: ", IF;
?>
Select an option to see the answer and solution.
<?php
define("NEW_GOOD_NAME_CONSTANT", "I have a value");
define("OLD_BAD_NAME_CONSTANT", NEW_GOOD_NAME_CONSTANT);
echo NEW_GOOD_NAME_CONSTANT;
echo OLD_BAD_NAME_CONSTANT;
?>
Select an option to see the answer and solution.
<?php
define("VAR_NAME","test");
${VAR_NAME} = "value";
echo VAR_NAME;
echo ${VAR_NAME};
?>
Select an option to see the answer and solution.