PHP Chapter 2 Assignment
PHP Chapter 2 Assignment
Case sensitive language distinguishes between uppercase and lowercase letters when
interpreting identifiers like variables, functions, and keywords.
3. Why does the PHP Group recommend that you use standard PHP script
delimiters to write PHP code declaration blocks?
PHP Group recommends using standard PHP script delimiters (<?php…..?>)
because they ensure compatibility across all PHP configurations and
environments.
4. Identify the two types of comments available in PHP and indicate when each
would be used.
Single-line comment: Using // or #. Used for short, one-line comments.
Multi-line comment: Using /* ... */. Used for longer comments or when
you need to comment out multiple lines of code.
4. Write PHP code to display any text on the browser uses HTML formatting
tags within the echo statements.
<?php
echo "<h1>This is a heading</h1>";
echo "<p>This is a paragraph with <strong>bold text</strong> in it.</p>";
?>
Objective and MCQ’s
1. What do you use to separate multiple argument that are passed to a function …..a
comma(B)
a) A period ( . )
b) A comma ( , )
c) A forward slash ( / )
d) A backward slash ( \ )
2. You create line comments in PHP code by adding _//__ to a line you want to use a
comment. a) ||
b) **
c) /*
d) //
3. Block comments begin with /* and end with ____ */
a) */
b) /*
c) //
d) **
a) 0 or 1
b) Greater 1
c) Less than 1
d) Not all above
5. The rules for using a programming language are called _syntax______.
a) Protocols
b) Syntax
c) Variables
d) Comments
6. We can use HTML elements in the PHP scripting. You chose corrects code are
following. echo “<h1> Pakistan</h1>”;