Web Systems Development (CSC-215) Lecture 3: Introducing PHP Wednesday 7th February 2018
Functions User defined Inbuilt PHP function An integer representation of time using Unix timestamp convention.
PHP Manual Reference
Using the function
Get date from 17 days ago
Variable Scope Local variables, e.g., arguments to a function
Out of scope
Re-arranged
Or passed as argument Longdate modified
Global Variables Avoid unless absolutely necessary because its bad programming practice.
Static Variables
Static Variables Only predetermined values allowed
Expressions
Booleans TRUE & FALSE
Literals and Variables
Expressions and Statements
Operators
Precedence
Relational Operators
Identity Operator Only 1 is printed
Not identical Only 2 is printed
Conditionals
Conditionals
Conditionals
Switch Default and break, as in C++
Loops
Loops
Loops
Class Activity Print the current date and time as per the given formatting, and then print 9 future date and time values in 12 hour increments. Maintain HTML formatting as well (h1 and p tags used). Set the correct time zone for WampServer if needed.
Lecture content adapted from chapters 2 & 3 of Learning PHP, MySQL, JavaScript, CSS & HTML5, 3rd Edition, by Robin Nixon.