Changes

PHP Functions

828 bytes added, 19:49, 31 May 2007
New page: In the world of programming and scripting there are two ways to write code. One way is to write long, sprawling and monolithic sections of script. Another is to break the scripts up into t...
In the world of programming and scripting there are two ways to write code. One way is to write long, sprawling and monolithic sections of script. Another is to break the scripts up into tidy, self contained modules that can be re-used without having to re-invent the same code over and over again. Obviously the latter is highly preferable to the former, and the fundamental building block of this appraoch to writing PHP scripts in the ''function''.

== What is a PHP Function? ==

Functions are basically named scripts that can be called upon from any other script to perform a specifc task. Values (known as ''arguments'') can be passed into a function so that they can be used in the function script, and functions can, in turn, return results to the location from which they were called.

== How to Write a PHP Function ==