Category PHP
Arrow Functions in PHP
PHP 7.4 version has introduced arrow functions, which provides a concise and shorter syntax to define anonymous functions. Arrow functions automatically capture variables from the parent scope by value, making using closures easier and cleaner. The general syntax to define…
Anonymous Function in PHP
When you define a function in PHP, you give it a name, which allows you to be called later by referencing this name. However, PHP also supports anonymous function like other programming languages. An anonymous function, also known as closure,…
Pass by Value and Pass by Reference in PHP
PHP supports two kinds of methods for passing arguments to functions: pass by value and pass by reference. Passing an argument by value is the most common way to pass value to a function. In PHP, arguments are passed by…
PHP Return
The return statement in PHP allows you to return a value from the function. If you want to return a value from the PHP function, you can use the return keyword, followed by the value to be returned. The return…
Functions in PHP

In this tutorial, we will learn about the concepts of functions in PHP. A function is a block of reusable code that performs a specific task. It will only execute when “someone” calls it. If you do not call it,…
