Programming in PHP Notes
Subject Overview
Programming in PHP covers PHP fundamentals and control structures, functions/
Read moreShow less
A 5-credit core theory paper.
Subject at a glance
4
Units
30
Topics
5
Credits
4
Infographics
Unit-wise Syllabus
4 units — open any unit for detailed topic-wise notes, diagrams and important exam questions
- Evolution of PHP
- PHP scripting basics
- receiving user input
- PHP data types
- operators
- variable manipulation and scope
- control structures (if/elseif, switch, while, do-while, for loops, nesting)
Study guide
PHP is a server-side scripting language for dynamic websites. You study its evolution, scripting basics, receiving user input, data types, operators, variable manipulation and scope and control structures (if-elseif, switch, while, do-while, for, nesting). Run every small script on a local server to see the output.
- Function definition/creation/return values
- user-defined and dynamic functions
- default arguments
- string formatting/comparison/matching
- index-based and associative arrays
- array looping with each() and foreach()
Study guide
You study functions (definition, return values, user-defined and dynamic functions, default arguments), string formatting, comparison and matching, and arrays: indexed and associative, with looping through foreach. Practise array and string functions; they are used in almost every PHP program.
- Working with forms and superglobal variables
- importing and accessing user input
- opening/copying/renaming/deleting files
- working with directories
- generating images with PHP
- MySQL database connectivity
- DML operations (insert, delete, update, select)
- joins (cross, inner, outer, self)
Study guide
You study forms and superglobals, importing user input, file operations (open, copy, rename, delete), directories, generating images, MySQL connectivity, insert, delete, update and select operations and joins. Build a small form-to-database application end to end.
- Setting and deleting cookies
- session creation and destruction
- encoding/decoding session variables
- FTP/SMTP server introduction
- math functions
- file upload/download
- email with PHP
- error tackling and debugging
- PHP project requirements analysis
Study guide
You study cookies, sessions, encoding and decoding session variables, FTP and SMTP basics, math functions, file upload and download, sending email, error handling and debugging and the requirements analysis for a PHP project. Use sessions to build a simple login system.
Why Programming in PHP Matters
PHP and MySQL power a very large share of websites, including WordPress, so PHP skills lead directly to web development and freelance work.
How to Prepare for Programming in PHP
- Build a small database-driven project such as a login system or blog.
- Always validate and sanitise user input.
- Learn the difference between GET and POST and between cookies and sessions.
Programming in PHP: Frequently Asked Questions
What is the difference between cookies and sessions?
Cookies store small data in the user's browser, while sessions store data on the server and identify the user with a session ID.
Which database is commonly used with PHP?
MySQL is the most common database used with PHP.
