⌘K
Noting Found

View all related articles

Using Arrow Functions In PHP

Snippets 1 min read

Sometimes we need just to make a line in a function or callback and, Arrow Functions in PHP. Came with version 7.4 we can do it easily without the full function.

Instead Of This

1Route::get('dashboard', function () {
2 return view('dashboard');
3});

Do This

1Route::get('/dashboard', fn () => view('dashboard'));

And you are good to go!

For more info check out php documentation


Related Tags

About the Author

Oussama's Profile Picture
Oussama
Full Stack Web Developer

I'm a full stack web developer and telecommunications engineer who love to share knowledge and build stuff online!


Comments

Join our newsletter

Subscribe to Our Newsletter and never miss our offers, latest news, Articles, etc.

We care about the protection of your data. Read our Privacy Policy.