--- title: 'Use match () or switch () statements to conditionally scope database queries based on query strings in the request' tweet_id: '1471864655710670854' thread_slug: weekly-thread-2022-01 author_username: archtechx images: - 'https://pbs.twimg.com/media/FGmQH5nXEAs4mnv.jpg' created_at: 2021-12-17T15:27:34+00:00 slug: use-match-or-switch-statements-to-conditionally-scope-database-queries-based-on-query-strings-in-the-request --- Remembered this great tip recently, and it's nice to see how fast PHP evolves The exact same behavior can be implemented using match () with a default value, which also removes the need for the second callback ⚡️ https://twitter.com/reinink/status/1233017064492761088