PHP with MySQL Beoyond the Basics
Chapter 2: Intermediate PHP Techniques
This chapter covers simple PHP concepts.
Exericses
- Variable Variables Part 1 | Part 2
- Part 1 uses some very simple examples of using a dynamic variable. Part 2 shows a more practical application where student names are found using their seat assignments.
- Applying More Array Functions
- The page displays using
array_shift
,array_unshift
,array_pop
, andarray_push
. - Building Dates and Times: Epoch/Unix
- The page displays using
time()
,mktime()
, andstrtotime()
, all of which display the Unix timestamp. - Formatting Dates and Times: Strings and SQL
- This exercises teaches how to use the
strftime
function to format dates. The first part of the exercise has the date set to January 31, 2011 to illustrate how leading zeros work and how to get rid of them. The second part of the exercise simply shows the format for MySQL dates. - Setting Server and Request Variables
- The page displays a list of server variables and their values.
- Establishing Global and Static Variable Scope
- The page displays three examples dealing with global, local, and static variables.
- Making a Reference Statement
- The page displays the difference between a variable assignment and a variable reference.
- Using References as Function Arguments
- The page displays the results of using references in function arguments.
- Using References as Function Return Values
- The page displays various ways of changing the value of referenced variables.