⌘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 | Technical Writer

Oussama is an experienced full-stack web developer with a strong focus on Laravel. He's passionate about crafting web applications with Filament and the TALL Stack. With 8+ years of experience, and he's a dedicated open-source contributor.

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.