Test Your Knowledge: Questions

Question 5-1

What is the main benefit of using a function?

Question 5-2

How many values can a function return?

Question 5-3

What is the difference between accessing a variable by name and by reference?

Question 5-4

What is the meaning of “scope” in PHP?

Question 5-5

How can you incorporate one PHP file within another?

Question 5-6

How is an object different from a function?

Question 5-7

How do you create a new object in PHP?

Question 5-8

What syntax would you use to create a subclass from an existing one?

Question 5-9

How can you call an initializing piece of code when an object is created?

Question 5-10

Why is it a good idea to explicitly declare properties within a class?

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

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.