PHP Test Questions and Answers
What does php stand for? - Answer-PHP stands for PHP: Hypertext Preprocessor
is PHP server side or client side scripting language? - Answer-server side
how are php files returned to the browser? - Answer-PHP files are returned to the browser as plain
HTML
how is a php started and ended? - Answer-A PHP scripting block always starts with <?php and ends with
?>
where can a php script be placed in the document? - Answer-anywhere
how must each php code line end? - Answer-with a semi colon
what is the purpose of the semi colon? - Answer-it is a separator and used to distinguish one set of
instructions from another
what are two basic statements to output text with PHP? - Answer-echo and print
, what happens if the php file has an html extension instead of PHP? - Answer-the php code will not be
executed
how is a single line comment made in php? - Answer-With //
how is a comment block made? - Answer-/* */
What are variables used for? - Answer-Variables are used for storing values, such as numbers, strings or
function results, so that they can be used many times in a script.
what do all variables start with? - Answer-All variables in PHP start with a $ sign symbol.
The correct way of setting a variable in PHP: - Answer-$var_name = value;
is PHP strongly or loosely typed? - Answer-loosely
in php does a variable need to be declared (created) before being set? - Answer-no, php automatically
creates the variable and sets it to the correct type.
What is meant by the term strongly typed? - Answer-variables have to be defined before they can be
used
in php how must a variable name start? - Answer-A variable name must start with a letter or an
underscore _
What kinds of characters can a variable name contain? - Answer-A variable name can only contain
alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ )
What does php stand for? - Answer-PHP stands for PHP: Hypertext Preprocessor
is PHP server side or client side scripting language? - Answer-server side
how are php files returned to the browser? - Answer-PHP files are returned to the browser as plain
HTML
how is a php started and ended? - Answer-A PHP scripting block always starts with <?php and ends with
?>
where can a php script be placed in the document? - Answer-anywhere
how must each php code line end? - Answer-with a semi colon
what is the purpose of the semi colon? - Answer-it is a separator and used to distinguish one set of
instructions from another
what are two basic statements to output text with PHP? - Answer-echo and print
, what happens if the php file has an html extension instead of PHP? - Answer-the php code will not be
executed
how is a single line comment made in php? - Answer-With //
how is a comment block made? - Answer-/* */
What are variables used for? - Answer-Variables are used for storing values, such as numbers, strings or
function results, so that they can be used many times in a script.
what do all variables start with? - Answer-All variables in PHP start with a $ sign symbol.
The correct way of setting a variable in PHP: - Answer-$var_name = value;
is PHP strongly or loosely typed? - Answer-loosely
in php does a variable need to be declared (created) before being set? - Answer-no, php automatically
creates the variable and sets it to the correct type.
What is meant by the term strongly typed? - Answer-variables have to be defined before they can be
used
in php how must a variable name start? - Answer-A variable name must start with a letter or an
underscore _
What kinds of characters can a variable name contain? - Answer-A variable name can only contain
alpha-numeric characters and underscores (a-z, A-Z, 0-9, and _ )