PHP

PHP

Syntax has 17 Questions
What will be the output of the following PHP code ?
  1. <?php
  2. "Hello World"
  3. ?>

Error
Hello World
Nothing
Missing semicolon error
What will be the output of the following PHP code ?
  1. <?php
  2. print_r "Hello world"
  3. ?>

Error
Hello World
Nothing
Missing semicolon error
What will be the output of the following PHP code ?
  1. <?php
  2. echo 'Hello World';
  3. <html>
  4. Hello world
  5. html>
  6. ?>

Hello world
Hello World Hello World
Hello world Hello World
Syntax Error
What will be the output of the following PHP code ?
  1. <?php
  2. $color = "red";
  3. echo "$color";
  4. echo "$COLOR";
  5. echo "$Color";
  6. ?>

redredred
redred
red
Error
What will be the output of the following PHP code ?
  1. <?php
  2.  # echo "Hello world";
  3.  echo "# Hello world"; 
  4. ?>

# Hello world
Hello world# Hello world
Hello world
Error
What will be the output of the following PHP code ?
  1. <?php
  2. echo "Hello World"
  3. ?>

Hello world
Hello world in italics
Nothing
Error
What will be the output of the following PHP code ?
  1. <?php
  2. <?php
  3. echo "Hello world";
  4. ?>
  5. ?>

helloworld
Hello world
Nothing
Error
What will be the output of the following PHP code ?
  1. <?php
  2. $color = red;
  3. echo "\$color";
  4. ?>

red
$color
\red
Error
What will be the output of the following PHP code ?
  1. <?php
  2. /*
  3. echo "Hello world";
  4. */
  5. ?>

Hello world
Nothing
error
/* Hello world */
What will be the output of the following PHP code ?
  1. <?php
  2. $color = red;
  3. echo "$color" . red ;
  4. ?>

red red
red
Error
Nothing
What will be the output of the following PHP code ?
  1. <?php
  2. $color1 = red;
  3. $color2 = green;
  4. echo "$color1"."$color2";
  5. ?>

red green
red
green
Error
What will be the output of the following PHP code ?
  1. <?php
  2. $color = "red";
  3. $color = "green";
  4. echo "$color";
  5. ?>

red
green
red green
error
What will be the output of the following PHP code ?
  1. <?php
  2. $color1 = "red";
  3. $color2 = "green";
  4. echo "$color1" . "$color2";
  5. ?>

red
green
red green
redgreen
What will be the output of the following PHP code ?
  1. <?php
  2. $color1 = "red";
  3. $color2 = "green";
  4. echo "$color1" + "$color2";
  5. ?>

redgreen
red green
0
error
What will be the output of the following PHP code ?
  1. <?php
  2. $color1 = "red";
  3. $color2 = "red";
  4. echo "$color1" + "$color2";
  5. ?>

redgreen
red green
0
1
What will be the output of the following PHP code ?
  1. <?php
  2. $color1 = "1";
  3. $color2 = "1";
  4. echo "$color1" + "$color2";
  5. ?>

11
2
0
1
What will be the output of the following PHP code ?
  1. <?php
  2. $color1 = "red";
  3. $color2 = "1";
  4. $color3 = "grey"
  5. echo "$color1" + "$color2" . "$color3";
  6. ?>

1grey
grey
0
red1grey