Full Stack LAMP - MEAN Developer, Python developer. Certified Azure Developer. Freelance programmer/consultant/trainer.

Named arguments allow you to pass input data into a function/method based on their argument name instead of the argument order. This is a useful feature no we don’t have to remember the order of the arguments and we don’t have to pass the default arguments to pass something which is in the end or middle.

PHP 8.0 allows named parameters in function/method calls in addition to traditional positional parameters. Below is an example.

function sum($a, $b){
    return a+b;
test(b: 1, a: 1); // 2

function sum($a=10, $b){
    return a+b;
test(b: 10); // 20

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments