< Back To Php Tests

PHP Basic Test

1. PHP files have a default file extension of ?


2. A PHP script should start with ___ and end with ___ ?

< php >
< ? php ?>
<?php ?>
None of the above

3. PHP runs on which side ?


4. We can use ___ to comment a single line ?

None of the above

5. Which of the following php statement/statements will store 111 in variable num ?

int $num = 111;
int mum = 111;
$num = 111;
111 = $num;

6. What will be the output of the following PHP code ?

Hello world
/* Hello world */

7. Which of following variables can be assigned a value to it ?


8. What PHP stands for ?

Hypertext Preprocessor
Pre Hypertext Processor
Pre Hyper Processor
Pre Hypertext Process

9. What is the difference between print() and echo() ?

print() can be used as part of an expression, while echo() can’t
echo() can be used as part of an expression, while print() can’t
echo() can be used in the CLI version of PHP, while print() can’t
There’s no difference: both functions print out some text!

10. Which of the following are correct ways of creating an array ?

state[0] = “karnataka”;
$state[] = array(“karnataka”);
$state[0] = “karnataka”;
None of the above