Functions Declaring and Calling Functions Passing Arguments to Functions Returning Values from Functions Understanding Variable Scope
Declaring and Calling Functions • Declaring a function • Calling a function • Defining functions before or after calling them
Declaring Function
Calling a function
Defining functions before or after calling them
Passing Arguments to Functions • Declaring a function with an argument • Specifying a default value • Defining a two-argument function • Calling a two-argument function • Multiple optional arguments • Changing argument values
Declaring a function with an argument
Specifying a default value
Defining a two-argument function
Calling a two-argument function
Multiple optional arguments
Changing argument values
Returning Values from Functions • Capturing a return value • Returning a value from a function • Using a return value in an if( ) statement • Returning an array from a function • Using an array returned from a function • Multiple return statements in a function • Passing a return value to another function • Using return values with if( ) • Functions that return true or false • Assignment and function call inside a test expression
Capturing a return value
Returning a value from a function
Using a return value in an if( ) statement
Returning an array from a function
Using an array returned from a function
Multiple return statements in a function
Passing a return value to another function
Using return values with if( )
Functions that return true or false
Assignment and function call inside a test expression
Understanding Variable Scope • Variable scope • The $GLOBALS array • Modifying a variable with $GLOBALS • The global keyword
Variable scope
The $GLOBALS array
Modifying a variable with $GLOBALS
The global keyword
Functions in php

Functions in php