PHP Functions

Example 1: Built-in Function

Original text: hello world

Using strtoupper(): HELLO WORLD

Example 2: User-Defined Function

Hello, Anushka! Welcome to my PHP page.

Explanation

Functions are blocks of code that perform specific tasks and can be used whenever they are needed. PHP has built-in functions, such as strtoupper(), which changes text to uppercase. Programmers can also create their own functions. A user-defined function can accept information, perform a task, and return a result.

Back to Activity 3 Home