PHP Functions Example

Built-in Function: strlen()

The length of the string 'Hello, PHP!' is 11 characters.

User-Defined Function: calculateArea()

The area of a rectangle with length 5 and width 10 is 50 square units.

In PHP, functions are blocks of code that can be reused. Built-in functions, like strlen(), are provided by PHP, while user-defined functions are created by developers. Functions allow for modular code and can take arguments and return values. Using functions reduces repetition and improves code maintainability.