Category: PHP, javascript

The switch statement in PHP is great when you want check condition on the same expression without incorporating many if statements altogether.

Now, this looks fine in comparison to the if-else statement as you don’t have to explicitly compare the expression explicitly.

An alternative for switch statement called “Match expression” has been accepted in this RFC. The RFC proposes adding a new match expression that is similar to switch but with safer semantics and the ability to return values.

Follow me on Twitter @amit_merchant Match expression - An alternative to switch statement in PHP 8 This experimental CSS Overview feature of Chrome is awesome The many ways to take screenshots on Ubuntu Get your blog running in seconds with Jekyll in 2020 Change URL query parameters using JavaScript
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners