Chapter Five - PHP
Chapter Five - PHP
Introduction to PHP
Basic PHP Syntax
PHP Comments
Predefined and User Variables in PHP
PHP Output Statements
Data Types in PHP
Arithmetic and Logical Operators
Conditional and looping Statements
Arrays and functions in PHP
Working with MySQL
Form Processing using PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 2
Introduction
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 3
Basic Features of PHP
Extensive Library Support: Rich set of libraries and frameworks (e.g., Laravel,
Symfony) for various functionalities.
Database Integration: Strong support for interacting with databases, especially
MySQL.
Simple Learning Curve: Easy for beginners to pick up due to its C-like syntax.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 5
Disadvantages of PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 6
Disadvantages of PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 7
Basic PHP Syntax
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 8
Basic PHP Syntax
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 9
Basic PHP Syntax
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 11
Comments in PHP
Single-line comments begin with //. Anything following //
on the same line is treated as a comment.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 12
Predefined and User Variables in PHP
PHP provides several predefined variables that hold
information about the server, user input, and more
Predefined variables
1. $_GET
• Contains data sent to the script via URL parameters using the
HTTP GET method. Commonly used for retrieving form data from the
URL. Example: assume the URL is example.php?name=John&age=30
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 13
Predefined and User Variables in PHP
Predefined variables
2. $_POST
• Holds data submitted to the script via the HTTP POST method.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 14
Predefined and User Variables in PHP
Predefined variables
3. $_REQUEST
• Combines data from $_GET, $_POST, and $_COOKIE.
• Example: Assume the script can accept data from both GET
and POST methods.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 15
Predefined and User Variables in PHP
Predefined variables
4. $_SESSION
• Manages session variables that can be used across
multiple pages during a user's visit.
• Useful for storing user-specific information.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 16
Predefined and User Variables in PHP
Predefined variables
5. $_SERVER
• Provides information about the server and the execution
environment.
• Example: Assume you want to get the server's IP address
and the user's browser.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 17
Predefined and User Variables in PHP
Advantages
• Ease of Use: These variables simplify the process of
collecting data from forms submitted via GET or POST
methods.
• Common Usage: Widely used in web development for
handling form data and user input.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 18
Predefined and User Variables in PHP
Disadvantages/Limitations:
• Security Concerns: Data from $_GET and $_POST may need
to be validated and sanitized to prevent security
vulnerabilities like SQL injection or cross-site
scripting.
• Data Visibility: Data sent via $_GET is visible in the
URL, which may pose a security risk if sensitive
information is passed.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 19
Predefined and User Variables in PHP
Predefined variables - $_SESSION
Advantages:
Disadvantages/Limitations:
Disadvantages/Limitations:
• Potential for Spoofing: Some values, like user agent, can be easily
manipulated, posing a risk for security-sensitive operations.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 21
Predefined and User Variables in PHP
Disadvantages/Limitations:
User variables
User variables are created by the programmer to store and
manipulate data:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 23
Predefined and User Variables in PHP
User variables
Variable Naming Rules:
User variables
Scope:
Initialization:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 25
Predefined and User Variables in PHP
User variables
• Type Consistency:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 26
Predefined and User Variables in PHP
User variables
• Memory Management:
• Security Considerations:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 27
Predefined and User Variables in PHP
User variables
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 28
PHP Output Statements
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 29
PHP Output Statements
2. print Statement: is similar to echo and is used to output text. It
can also be used with or without parentheses.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 30
PHP Output Statements
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 31
Data Types in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 32
Data Types in PHP
Boolean: Represents a binary value, typically used for logical
conditions. Example: $isTrue = true;
Example:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 33
Data Types in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 34
Operators in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 35
Operators in PHP
5. Increment/Decrement Operators: ++ and -- (with prefix and
postfix)
Conditional Statements
Looping Statements
• For loop
• While loop
• Do … while loop
• forEach loop
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 37
Arrays in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 38
Arrays in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 39
Arrays in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 40
PHP Functions
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 41
PHP Functions
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 42
Overview on MySQL database
There are four ways you can generally consider when you want to
connect to a previously created database.
1. Connecting to MySQL Databases: The syntax for connecting to a
MySQL database would be:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 44
Connecting to a Database
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 45
Connecting to a Database
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 46
Connecting to a Database
4. Connecting to PDO Databases: PDO stands for PHP Data Objects and
is a consistent way to access databases, which promises much
easier portable code.
• PDO is more like a data access layer which uses a unified API
rather than an abstraction layer
• PDO is widely used today for a bunch of advantages it offers.
PDO allows for prepared statements and it throws catchable exceptions
which means better error handling and uses blind parameters in statements
which increases security.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 47
Connecting to a Database
PDO - It represents a connection between PHP and the database.
Connecting to PDO Databases:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 48
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 49
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 50
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 51
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 52
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 53
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 54
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 55
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 56
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 57
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 58
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 59
CRUD Operations in PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 60
Security Considerations
Prevent SQL Injection:
• Use prepared statements or parameterized queries.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 61
PHP Form Handling
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 63
PHP Include & Require Statements
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 64
PHP Include & Require Statements
The include and require statements are the same, except upon
failure of code execution where:
• require will produce a fatal error (E_COMPILE_ERROR) and stop the
script from executing
• include will only produce a warning (E_WARNING) and the script will
continue
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 65
PHP File Upload
PHP offers a robust mechanism for handling file uploads from
web forms. Here's a breakdown of the key steps involved:
1. HTML Form Creation:
• Construct an HTML form element with the <form> tag.
• Set the action attribute to the PHP script that will process
the upload.
• Use the method attribute and set it to POST (standard for file
uploads).
• Include a file input field using the <input type="file"
name="filename"> element, where filename is the name you'll
reference in your PHP script.
• Add a submit button using the <input type="submit"
value="Upload"> element.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 66
PHP File Upload
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 67
PHP File Upload
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 68
PHP File Upload
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 69
PHP File Upload
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 70
PHP File Upload
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 71
PHP Date() Function
The date() function is used to format a time or a date.
Syntax: string date (format,timestamp)
• This function returns a string formatted according to the
specified format.
The format parameter in the date() function specifies the format of
returned date and time.
The timestamp is an optional parameter, if it is not included then
the current date and time will be used.
PHP Date() - Format the Date
• The required format parameter in the date() function specifies how
to format the date/time.
• Here are some characters that can be used:
• d - Represents the day of the month (01 to 31)
• m - Represents a month (01 to 12)
• Y - Represents a year (in four digits)
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 72
PHP Date() Function
Other characters, like"/", ".", or "-" can also be inserted
between the letters to add additional formatting:
Example 1.
< ?php
echo date("Y/m/d") . "<br />";
echo date("Y.m.d") . "<br />";
echo date("Y-m-d");
?>
• The time() function is used to get the current time as a
Unix timestamp
The mktime() function is used to create the timestamp for a
specific date and time
Syntax: mktime(hour, minute, second, month, day, year)
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 73
PHP Date() Function
Example 2
<?php
//Prints something like: Monday
echo date("l");
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 76
PHP Cookies
Creating a Cookie:
• setcookie(name, value, expire, path, domain, secure, httponly): Sets a
cookie with the specified parameters.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 77
PHP Cookies
we use the isset() function to find out if a cookie has been set
Retrieving a Cookie:
• $_COOKIE: An associative array containing all cookies sent by the
client.
Modifying a Cookie:
Deleting a Cookie:
• Setting the expiration time to a past value deletes the cookie.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 78
PHP Session
A session is a way to store information on the server side that
persists across multiple requests from the same user during a
defined session.
Characteristics:
• Storage: Information is stored on the server side.
• Size Limit: Generally has a higher limit compared to cookies.
• Lifetime: Usually tied to the user's session and expires when the
user closes the browser or remains inactive for a specified
period.
• Accessibility: Accessed and managed on the server side.
• Purpose: Used to maintain user-specific data, such as login
information, throughout a user's interaction with a website.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 80
PHP Session
Starting a Session
Ending a Session
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 81
PHP Session
Session Configuration:
• session_save_path(): Gets or sets the current session save path.
• session_set_save_handler(): Sets user-level session storage
functions which are used for storing and retrieving data
associated with a session.
Session Security:
• session_regenerate_id(): Updates the current session id with a
newly generated one.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 82
PHP Session
Handling Session Timeout
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 83
PHP Session
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 84
File Handling with PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 85
File Handling with PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 86
File Handling with PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 87
File Handling with PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 88
File Handling with PHP
Write to Files:
• fwrite() - Write to an open file
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 89
File Handling with PHP
File Modes:
• Read Modes:
• 'r': Open for reading.
• 'r+': Open for reading and writing.
• Write Modes:
• 'w': Open for writing. If the file doesn't exist, create it.
If it exists, truncate it.
• 'w+': Open for reading and writing. If the file doesn't exist,
create it. If it exists, truncate it.
• Append Modes:
• 'a': Open for writing. If the file doesn't exist, create it.
If it exists, move the file pointer to the end.
• 'a+': Open for reading and writing. If the file doesn't exist,
create it. If it exists, move the file pointer to the end.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 90
File Handling with PHP
Deleting Files:
• unlink() - Deletes a file
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 91
File Handling with PHP
Handling Errors:
• feof() - Tests for end-of-file on a file pointer
File Information:
• filesize() - Gets the size of the file
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 92
File Handling with PHP
Directory Operations:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 93
File Handling with PHP
File Copy and Rename:
copy() - Copy a file
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 94
File Handling with PHP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 95
PHP Mathematical Functions
PHP provides a variety of mathematical functions to perform
operations like basic arithmetic, rounding, logarithmic
functions, trigonometry, etc.
Basic Arithmetic Functions:
• abs(number): Returns the absolute (positive) value of a number.
• ceil(number): Rounds a number up to the nearest integer.
• floor(number): Rounds a number down to the nearest integer.
• round(number, precision): Rounds a number to a specified
precision (optional second argument).
• exp(number): Calculates the exponent of e (Euler's number) raised
to the power of number.
• log(number, base): Calculates the logarithm of number to a
specified base (optional second argument, defaults to base 10).
• log10(number): Calculates the base-10 logarithm of number.
• pow(number, power): Raises number to the power of power.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 96
PHP Mathematical Functions
Basic Arithmetic Functions:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 97
PHP Mathematical Functions
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 98
PHP Mathematical Functions
Trigonometric Functions (operate in radians):
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 99
PHP Mathematical Functions
Other
Mathematical
Functions:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 101
PHP OOP
OOP is a programming paradigm that uses objects and classes to structure code.
Procedural programming is about writing procedures or functions that perform
operations on the data, while OOP is about creating objects that contain both
data and functions.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 102
PHP OOP
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 103
PHP OOP
Constructors and destructors helps for reducing the amount of code.
Constructor: is a special
method called when an object
is created.
It is mainly used to
initialize object properties
upon creation of the object.
Destructor: is a special
method called when an object
is destroyed/exited.
It is automatically called at
the end of the script & used for
cleanup tasks
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 104
PHP OOP
Basic OOP Concepts
Encapsulation: is the bundling of
data (properties) and methods that
operate on the data into a single
unit (class).
Wrapping up data member and method
together into a single unit
Enclosing the internal details of
the object to protect from external
sources
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 105
PHP OOP
Basic OOP Concepts …
Inheritance: allows a class
(subclass/derived class) to
inherit properties and
methods(Public/protected)
from another class
(superclass/base class).
An inherited class is defined
by using the extends keyword.
Inherited methods can be
overridden by redefining the
methods (use the same name)
in the child class.
What is Final keyword.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 106
PHP OOP
Basic OOP Concepts …
Polymorphism: allows objects of different
classes to be treated as objects of a
common superclass. It involves method
overriding.
the ability of objects of d/t classes to
take on different forms and exhibit
different behaviors while sharing a common
interface.
allows methods to perform different
actions based on the object they are
called upon, enhancing code flexibility
and reusability.
Q. What is the difference between Compile-time polymorphism
(Overloading) and Run-time polymorphism(overriding)?
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 107
PHP OOP
Basic OOP Concepts …
Interfaces and abstract classes can also facilitate polymorphism
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 108
PHP OOP
Basic OOP Concepts …
Interfaces: define a contract for
classes that implement them. They
ensure that classes have specific
methods.
Multiple classes can implement the
same interface, enabling
polymorphism by treating different
objects as instances of the same
interface.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 110
PHP OOP
Basic OOP Concepts …
Access/Visibility modifiers:
control the access level of
properties and methods.
public: Accessible from
anywhere.
protected: Accessible within
the class and its subclasses.
private: Accessible only
within the class.
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 111
PHP OOP
Basic OOP Concepts …
Example:
Creating, Using,
and Extending
Classes:
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 112
Reading assignment on other OOP concepts: -
• Aggregation
• Association
• Composition
• Namespaces
• Traits
• Constants
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 113
Thank You!!!
Question???
@ WDU: WiT: School of Computing: Programming Chair 2024 Hypertext Preprocessor (PHP): Chapter 5
Slide 114