In these sections, we’ll see more advanced PHP syntax for elements such as functions, arrays, and tiles. ‘Mese will allow us to create larger, well-structured programs that interact with interesting data.
Like functions and methods in C, C++, and Java, a PHPfilliction is a named group of statements that can be executed many times. PHP functions can accept parameters, which are declared by writing their names with dollar signs in front; no types are declared. Example 5.33 shows the syntax. PHP functions can also return values. To return a value from a function, place a return statement in the function’s body, using the syntax shown in Example 5.34. For example, the function shown in Example 5.35 computes the slope of a line based on two points (xi, j,), (x202).
Download Full Pdf version or from here