Functions in PHP

Built-in Function Example

The length of the word 'Programming' is: 11

User-Defined Function Example

Hello, Hung!


Functions are reusable blocks of code designed to perform a specific task. Built-in functions, such as strlen(), are already provided by PHP and perform common operations. User-defined functions are created by programmers to organize code and avoid repetition. Functions may accept parameters and return values, making programs more modular and efficient.