Skip to content

Instantly share code, notes, and snippets.

@ieatkillerbees
Last active June 3, 2019 18:55
Show Gist options
  • Save ieatkillerbees/60c83c7dc0885a86497a to your computer and use it in GitHub Desktop.
Save ieatkillerbees/60c83c7dc0885a86497a to your computer and use it in GitHub Desktop.
Important Multi-Default Use Case
<?php
// Apparently I need to point out that this is a joke?
$foo = 101;
switch (true)
{
default:
less:
echo "$foo < 100!";
break;
default:
more:
echo "$foo > 100!";
break;
default:
same:
echo "$foo == 100!";
break;
default:
if ($foo < 100) {
goto less;
} elseif ($foo > 100) {
goto more;
} elseif ($foo == 100) {
goto same;
}
break;
}
@jcarouth
Copy link

A+ use case. Will adopt in all my legacy projects and projects I intend to bequeath to those I disdain.

@stoph
Copy link

stoph commented Jun 3, 2015

@arosemena, as her employer, I love it! Being able to come up with this is why Samantha is awesome.

@aeaia
Copy link

aeaia commented Jun 3, 2019

LGTM

@jrode
Copy link

jrode commented Jun 3, 2019

👍 can you merge this soon, i am blocked because i need this for my branch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment