Skip To Content

Athabasca University

Section 5.4 Advanced Features of PHP

Learning Objectives

After you have completed this section, you should be able to

  • use some advanced features of PHP when writing your server-side scripts.
  • interact with file systems and servers.
  • use network and protocol functions.
  • generate images.
  • use session control.

Activities

  • Carefully read the learning objectives.
  • Find and study some PHP scripts on the Web.
  • Find some examples of websites that use PHP with MySQL, and write a summary about the function and implementation of each website.
  • Watch the related sections of the presentation for Chapter 19;
  • Read Sections 19.8, 19.10, and 19.11 of Chapter 19 PHP.
  • Find answers to the study questions below.
  • Design a web page that can make a summary of news from a list of websites.
  • Write a web page that can used to upload files from known web users who browse the page, and put uploaded files into different directories according to the file types.
  • Consider how to design a website that can provide a personalized news service to registered individuals using PHP and MySQL.

Study Questions

  1. What are superglobal arrays in PHP?
  2. With PHP, how do you get information about clients’ environment?
  3. How do you access HTML5 form data from PHP?
  4. How can you process HTML5 form data with PHP?
  5. How do you use cookies in PHP?
  6. How do you upload files from a web client in PHP?
  7. Which of the methods post, put, and get can be used in uploading files from web clients?
  8. After a file has been uploaded, how do you know the name, size, and type of the file?
  9. What are some common programs with uploading files from web clients?
  10. What security issues may arise from uploading files from web clients?
  11. What directory and file functions are provided by PHP?
  12. How do you invoke shell commands on a server from within PHP scripts?
  13. How do you get and set environment variables in PHP?
  14. How do you send and read emails with PHP?
  15. What network lookup functions are provided by PHP? For what purposes?
  16. How do you back up or mirror files from hosts to hosts with PHP?
  17. What is cURL?
  18. What network functions does cURL provide?
  19. What functions does PHP provide to manage date and time?
  20. What are UNIX timestamps?
  21. How do you make a UNIX timestamps in PHP?
  22. How do you convert between PHP and MySQL date formats?
  23. How do you calculate the length of time between two dates in PHP?
  24. What can the calendar function in PHP be used for?
  25. What are some commonly used image formats?
  26. How do you set up image support in PHP?
  27. How do you create images with PHP?
  28. How do you use automatically created images in web pages?
  29. How do you use text and fonts to create images?
  30. How do you position text in image?
  31. How do you draw figures and graphing data?

Using Session Control in PHP

  1. What is session control?
  2. What is a cookie?
  3. What is a session ID? How is a session ID used in session control?
  4. How do you set cookies from PHP?
  5. How do you start a session from PHP?
  6. How do you register session variables?
  7. How do you deregister session variables?
  8. How do you destroy a session?
  9. How can you configure a session control in PHP?
  10. What are magic quotes? How do you use them in PHP?
  11. Where can the function eval() be useful?
  12. What are the differences between the functions die() and exit in PHP?
  13. What is serialization in PHP?
  14. What information about the PHP environment can you get? How?

Review

Summary

PHP has many advanced features that can be used in developing websites. The most common use of PHP in website development is to work with databases. In this section your focus should be on other advanced features such as interacting with file systems and servers, using network and protocol functions, managing date and time, dynamically generating images and using them in web pages, using session control, and other special PHP features. You are also advised to study how to generate PDF documents in PHP as part of your professional preparation.

Updated May 06 2022 by FST Course Production Staff