PHP Functions

Built-in Function Example

The text is: Learning PHP

Using strlen(), the number of characters is: 12

User-Defined Function Example

Welcome to Activity 3, Student!

Explanation

A function is a group of instructions that performs a certain task. PHP has built-in functions, such as strlen(), that are already provided by the language. A programmer can also create a user-defined function for a specific task. Functions can accept information through parameters, process it, and return a result. They also help avoid repeating the same code many times.

Back to Activity 3