PHP TutorialLesson 20Free preview
PHP Functions
This lesson is part of PHP · All levels
Summary
A function is a block of code named that can be called over and over again, thus avoiding repeating the same code. This lesson discusses how to declare a function, send parameters, determine default values, and return results with return. With functionality, the program becomes more structured and easier to test.
Key points
- Functions are created with the keyword function followed by the name and the curve
- The value sent at the call is called the argument, declared as a parameter
- The parameter can be given a default value with the equals sign
- Returns the result to the function called
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.