PHP allows you to create high-quality dinamic pages and sites in a very short time and get the product, easily modifiable, and supported in the future.
Anyone who seriously wants to create the web applications, should know at least the basics of the PHP.
In this tutorial you can find the following:
- PHP – Syntax
- PHP – Echo
- PHP – Comments
- PHP – Variables
- PHP – Strings
- PHP – Constants
- PHP – Operators
- PHP – Functions
- PHP – Conditional Operator
- PHP – Switch
- PHP – Arrays
- PHP – While loop
- PHP – Do while loop
- PHP – For loop
- PHP – Foreach loop
- PHP – Break, Continue and Goto
- PHP – Files
- PHP – Include and Require commands
Apply Link For PHP Basic
Apply Link For PHP Basic Quiz
About the Quiz
Start Quiz
Test your knowledge with W3docs’ basic quiz made especially for beginners in PHP. Pass the test and get a Certificate of achievement!
The Test
The test contains 20 questions and there is no time limit. The test is not official, it’s just a nice way to see how much you know about PHP.
Count Your Score
You will get 5% for each correct answer. At the end of the Quiz, your total score will be displayed out of 100% maximum score.
Enrich your knowledge
At the end of the quiz you can see all the questions with the right answers. There will also be notes about the answers which will lead you to the appropriate page on the platform to enrich your knowledge. Read our HTML tutorial if you are not sure that you are ready for the quiz.
Quiz Answers
PHP Quiz Answers
What does PHP stand for?
Preprocessed Hypertext Page
Personal Home Page
Hypertext Transfer Protocol
PHP: Hypertext Preprocessor
Ans. PHP: Hypertext Preprocessor
PHP is considered a server-side scripting language
True
False
Ans. True
Which of the following extensions is a correct PHP file extension?
.html
.cpp
.php
.pxp
Ans. .php
How do you start the PHP scripting block?
Ans. ?php…?
Whitespace is not ignored in PHP
True
False
Ans. False
What does a semicolon indicate?
The end of a PHP statement or instruction
The start of a PHP statement or instruction
The end of a PHP script block
The start of a PHP script block
Ans. The end of a PHP statement or instruction
Variables in PHP start with
var
variable
$
#
&
Ans.$
Which is the correct way to start a multiple line PHP comment?
————–
/ ————– /
/* ———– */
{# ——— #}
Ans.
/* ———– */
PHP variables need to be declared before adding values to them
True
False
Ans. False
Which is the correct way to declare a PHP variable?
val = 10;
$10 = ‘val’;
$val;
$val = 10;
Ans. $val = 10
How do you output “Hello W3docs” in PHP?
Hello W3docs;
echo Hello W3docs;
echo (Hello W3docs) ;
echo (“Hello W3docs”) ;
echo ‘Hello W3docs’ ;
Ans. echo (“Hello W3docs”) ;
echo ‘Hello W3docs’ ;
What is the correct way of adding 1 to the variable?
$var =+ 1;
$var = $var+1;
$var += 1;
$var++;
Ans.
$var =+ 1;
An array is a special variable that is capable of holding more than one value at a time.
True
False
Ans. True
The (2>0 || 4>5) condition will return
True
False
Ans. True
What will be displayed in the browser?
Hello
Welcome to
Welcome to W3docs
Hello W3docs
Ans. HelloW3docs
Which of the following is the correct way to use the include command?
include ‘file.txt’;
include ‘file.php’;
file.php;
“file.php”;
Ans. file.php;
The (2>0 || 4>5) condition will return
True
False
Ans. True
What will be displayed in a browser ? 3 ) { echo “Welcome to “; } else { echo ” Say hello” } echo ” W3Docs !!”; ?>
Hello
Welcome to
Say hello
Hello W3docs !!
Say hello W3docs !!
Welcome to W3docs !!
Ans.
Say hello W3docs !!
What will be displayed in a browser ? = 0) { echo “Hello”; } else { echo “Welcome to “; } echo ” W3Docs”; ?>
Hello
Welcome to
Welcome to W3docs
Hello W3docs
Ans. Hello W3docs
When is the default case of switch statement executed?
When one of cases evaluate to true
When other cases evaluate to false
When other cases evaluate to true
Always
Ans. When other cases evaluate to false