Changes

Jump to: navigation, search

PHP Functions

16 bytes removed, 20:16, 27 October 2016
m
Text replacement - "<table border="0" cellspacing="0"> " to "<table border="0" cellspacing="0" width="100%">"
<table border="0" cellspacing="0" width="100%"><tr>
<td width="20%">[[PHP Flow Control and Looping|Previous]]<td align="center">[[PHP Essentials|Table of Contents]]<td width="20%" align="right">[[PHP Arrays|Next]]</td>
<tr>
<googlehtmlet>BUY_PHPphp</googlehtmlet>
== What is a PHP Function? ==
<googlehtmlet>ADSDAQBOX_FLOWadsdaqbox_flow</googlehtmlet>
Functions are basically named scripts that can be called upon from any other script to perform a specific 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.
</pre>
Although the variables and arguments in the first example (where the variables are not passed by reference) share the same name it is important to note that they are still separate, independent variables. In other words, modifying ''$var1'' within the function does not change the value assigned to the ''$var1'' variable declared outside the function. The ability to have two variables with the same name in this context is the result of something called ''variable scope'', a a topic that will be covered later in this chapter.
== Returning Values by Reference ==
</pre>
<googlehtmlet>BUY_PHP_BOTTOMphp</googlehtmlet>

Navigation menu