Answers to Chapter 4

  1. "To delete a variable, what function do you use" Unset(), of course! Answer "b" is correct.

  2. "To uppercase the first letter in a string, what function do you use" Answer "d" is correct: ucfirst() is the function to use.

  3. "What does the dl() function do, and what is the major disadvantage to using it" The dl() function loads an extension dynamically, but that extension gets unloaded soon after therefore it is very slow and should be avoided.

  4. "Which of the following statements are true about recursive functions" A recursive function is simply one that calls itself, therefore answer "a" is correct.

  5. "Regular expressions should be used whenever possible : true or false" Rubbish: false.

  6. "You always need to use addslashes() on variables before inserting them into a database: true or false" False: there's a php.ini variable called magic_quotes_gpc that may already have added slashes for you, so calling addslashes() again will only add slashes to the slashes.

  7. "Using register_shutdown_function(), you can register as many shutdown functions as you want: true or false?" Although there may well be a very high limit, it's not one worth worrying about: the answer is "true".

 

Next chapter: Answers to Chapter 5 >>

Previous chapter: Answers to Chapter 3

Jump to:

 

Home: Table of Contents

Follow us on Identi.ca or Twitter

Username:   Password:
Create Account | About TuxRadar