Difference between revisions of "PHP Functions"

From Techotopia
Jump to: navigation, search
(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...)
 
(What is a PHP Function?)
Line 4: Line 4:
  
 
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.
 
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.
 +
 +
PHP functions exist it two forms, functions that are provided with PHP to make your life as a web develeper easier, and those that you as a web developer create yourself.
  
 
== How to Write a PHP Function ==
 
== How to Write a PHP Function ==

Revision as of 19:51, 31 May 2007

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.

PHP functions exist it two forms, functions that are provided with PHP to make your life as a web develeper easier, and those that you as a web developer create yourself.

How to Write a PHP Function