Logo

Php Questions Set 53:

Quiz Mode

Which symbol is used for creating a variable in PHP?

1
2
3
4

Solution:

What will be the output?

<?php


$a = 10+10*5+15/5;

echo "$a";


?>

1
2
3
4

Solution:

Who is the father of PHP?

1
2
3
4

Solution:

What will be the output?

<?php


if($a=0){

    echo "Sun";

}

else{

    echo "Moon";

}


?>

1
2
3
4

Solution:

What will be the output?

<?php

$a=0;

$b=0;


for($i=0;$i<10;$i++)

{

      if(++$a<5 && $b++<7){  }

}

echo $a." ".$b;

?>

1
2
3
4

Solution:

 

Which of the following is/are an exception?

i) OutOfBoundException
ii) OutOfRangeException
iii) OverflowException
iv) UnderflowException

1
2
3
4

Solution:

Which of the following are exceptions?

 

i) BadFunctionCallException
ii) BadMethodCallException
iii) LogicException
iv) DomainException

1
2
3
4

Solution:

 What will be the output of the following PHP code? 

 

<?php

function a()

{

   function b()

   {

       echo 'I am b';

   }

   echo 'I am a';

}

a();

?>

1
2
3
4

Solution:

 Which function initializes the constants necessary for using the openlog(), clodelog(), and syslog() functions? 

1
2
3
4

Solution:

What will be the output of the following PHP code?

 

<?php

$num = "123";

if (!filter_var($num, FILTER_VALIDATE_INT))

echo("Integer is not valid");

else

echo("Integer is valid");

?>

1
2
3
4

Solution: