Answers to Chapter 8

  1. "What will the following function call return: is_readable("http://www.slashdot.org")" The answer is "false" - is_readable() doesn't work on remote files.

  2. "Which function locks files" Answer "c" of course, flock().

  3. "What is the primary difference between rename() and move_uploaded_file()" The latter only works on files that are uploaded, whereas rename() will rename or move any file that it is able to.

  4. "In the .ini file format, what is considered to be the start of a comment" The answer is "c", the semi-colon.

  5. "Which superglobal array contains information on uploaded files" The answer is "d", "None of the above". The $_FILES superglobal contains uploaded file information.

  6. "Under what circumstances can the file_exists() function report incorrect data" The results of this function are cached, which means if a file is checked then deleted and checked again, PHP will just report that it exists.

 

Want to learn PHP 7?

Hacking with PHP has been fully updated for PHP 7, and is now available as a downloadable PDF. Get over 1200 pages of hands-on PHP learning today!

If this was helpful, please take a moment to tell others about Hacking with PHP by tweeting about it!

Next chapter: Answers to Chapter 9 >>

Previous chapter: Answers to Chapter 7

Jump to:

 

Home: Table of Contents

Copyright ©2015 Paul Hudson. Follow me: @twostraws.