291
CHAPTER
Creating Dynamic Pages 12
What sorts of things can I use functions for?
A function can be used for any logical block of code.
Most often, you use functions to designate a set of
code that you need to call repeatedly, but some
developers use them simply to organize the code
into blocks.
Does my function have to go at the top of the
page?
No, it merely needs to be written before it is called.
Most developers place functions at the top of the
page to keep them together and easy to find, but
they can be placed anywhere.
● When you view the page in
the browser, the function
works.
8 At the point on the page
where you want to call the
function, type echo and
then the function name
followed by parentheses and
a semi-colon.
8
TIPS