Enter your Sign-on user name and password.

Forgot password?
  • Follow us on:
Loading video...

Start Learning Now

Our free lessons will get you started (Flash® 10 required).
Get immediate access to our entire library.

Sign up for Educator.com

Features Overview

  • Get on-demand access to our complete library
  • Search and jump to exactly what you need to learn
  • Track your progress
  • Download practice and lesson files
  • *Ask questions and get answers from our community & instructors

Introduction to Functions

  • A function is a group of PHP statements that can be executed on request by other PHP code using what’s known as a function call .
  • When reaching a function call, PHP halts execution of the current script, executes the function’s section of code, and then returns to executing the original script.
  • A function call is made by typing name of the function followed by a pair of parentheses.
  • Function arguments are expressions that can be 'passed' to a function by placing them in a comma-separated list between the parentheses of a function call.
  • Functions are themselves expressions and thus have a value. The value of a function is called its return value , and this value is 'returned' to the calling script.
  • Functions can be chained together by using the return value of one function as an argument to another.
  • php.net provides documentation, via a function reference , for all of the built-in functions PHP makes available to programmers. The documentation provides function prototypes , which are descriptions of the arguments a particular function accepts along with what type of data value it returns.
  • Functions in PHP can be defined to take optional arguments . In the php.net function reference, optional arguments are denoted in a function’s prototype by placing them within pairs of square brackets.
  • Additonal Resources:

Introduction to Functions

Lecture Slides are screen-captured images of important points in the lecture. Students can download and print out these lecture slide images to do practice problems as well as take notes while watching the lecture.

Computer Science: Introduction to PHP