Test Your Knowledge: Questions

Question 3-1

What tag is used to cause PHP to start interpreting program code? And what is the short form of the tag?

Question 3-2

What are the two types of comment tags?

Question 3-3

Which character must be placed at the end of every PHP statement?

Question 3-4

Which symbol is used to preface all PHP variables?

Question 3-5

What can a variable store?

Question 3-6

What is the difference between $variable = 1 and $variable == 1?

Question 3-7

Why do you suppose that an underscore is allowed in variable names ($current_user) whereas hyphens are not ($current-user) ?

Question 3-8

Are variable names case-sensitive?

Question 3-9

Can you use spaces in variable names?

Question 3-10

How do you convert one variable type to another (say, a string to a number)?

Question 3-11

What is the difference between ++$j and $j++?

Question 3-12

Are the operators && and and interchangeable?

Question 3-13

How can you create a multiline echo or assignment?

Question 3-14

Can you redefine a constant?

Question 3-15

How do you escape a quotation mark?

Question 3-16

What is the difference between the echo and print commands?

Question 3-17

What is the purpose of functions?

Question 3-18

How can you make a variable accessible to all parts of a PHP program?

Question 3-19

If you generate data within a function, provide a couple of ways to convey the data to the rest of the program.

Question 3-20

What is the result of combining a string with a number?

See the section Chapter 3 Answers in Appendix A for the answers to these ...

Get Learning PHP, MySQL, and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.