W3Schools PHP Quiz
7. How do you get information from a form that is submitted using the "get" method? Request.Form; $_GET[]; Request.QueryString;
$_GET[];
15. Which superglobal variable holds information about headers, paths, and script locations? $_SERVER $_GLOBALS $_GET $_SESSION
$_SERVER
23. How do you create an array in PHP? $cars = "Volvo", "BMW", "Toyota"; $cars = array("Volvo", "BMW", "Toyota"); $cars = array["Volvo", "BMW", "Toyota"];
$cars = array("Volvo", "BMW", "Toyota");
16. What is the correct way to add 1 to the $count variable? $count =+1 $count++; ++count count++;
$count++;
20. Which one of these variables has an illegal name? $myVar $my_Var $my-Var
$my-Var
4. All variables in PHP start with which symbol? $ & !
$
21. The setcookie() function must appear BEFORE the <html> tag. True False
True
24. The if statement is used to execute some code only if a specified condition is true True False
True
14. PHP allows you to send emails directly from a script True False
True
17. What is a correct way to add a comment in PHP? *\...\* <!--...--> /*...*/ <comment>...</comment>
/*...*/
1. What does PHP stand for? PHP: Hypertext Preprocessor Personal Hypertext Processor Private Home Page
PHP: Hypertext Preprocessor
25. Which operator is used to check if two values are equal and of same data type? != === == =
===
10. Include files must have the file extension ".inc" True False
False
22. In PHP, the only way to output text is with echo. True False
False
8. When using the POST method, variables are displayed in the URL: True False
False
6. The PHP syntax is most similar to: JavaScript Perl and C VBScript
Perl and C
18. PHP can be run on Microsoft Windows IIS(Internet Information Server): True False
True
19. The die() and exit() functions do the exact same thing. True False
True
13. What is the correct way to open the file "time.txt" as readable? open("time.txt"); open("time.txt","read"); fopen("time.txt","r"); fopen("time.txt","r+");
fopen("time.txt","r");
12. What is the correct way to create a function in PHP? new_function myFunction() create myFunction() function myFunction()
function myFunction()
5. What is the correct way to end a PHP statement? . New line ; </php>
;
11. What is the correct way to include the file "time.inc" ? <?php include "time.inc"; ?> <?php include file="time.inc"; ?> <?php include:"time.inc"; ?> <!-- include file="time.inc" -->
<?php include "time.inc"; ?>
2. PHP server scripts are surrounded by delimiters, which? <?php>...</?> <script>...</script> <?php...?> <&>...</&>
<?php...?>
9. In PHP you can use both single quotes ( ' ' ) and double quotes ( " " ) for strings: True False
True
3. How do you write "Hello World" in PHP? "Hello World"; Document.Write("Hello World"); echo "Hello World";
echo "Hello World";