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
<?php
class newObject { }
define('newObject::CONSTANT', 'Example');
echo newObject::CONSTANT;
?>
<?php
define("STR_VAR","Ravinder");
${STR_VAR} = "Singh";
echo STR_VAR;
echo ${STR_VAR};
?>
<?php
define('OCTAL_NUM1', 0500);
define('OCTAL_NUM2', 0300);
print OCTAL_NUM1;
echo "\n";
print OCTAL_NUM2;
?>
<?php
define("FIRST_NAME", "Ajit");
define("LAST_NAME", FIRST_NAME);
echo FIRST_NAME;
echo LAST_NAME;
?>
<?php
define('IF', 102);
echo "IF: ", IF;
?>
<?php
define("__LINE__", "She is beautiful");
echo "\n";
echo __LINE__;
?>
<?php
class Constants
{
define('MIN_VA', '10.10');
define('MAX_VAL', '20.20');
public static function getMin()
{
return self::MIN_VAL;
}
public static function getMax()
{
return self::MAX_VAL;
}
}
echo Constants::getMin();
echo Constants::getMax();
?>