Skip to content

Instantly share code, notes, and snippets.

@datamafia
Created February 8, 2015 20:13
Show Gist options
  • Save datamafia/dae1c97221b4b5893a05 to your computer and use it in GitHub Desktop.
Save datamafia/dae1c97221b4b5893a05 to your computer and use it in GitHub Desktop.
Using switch statement and additional evaluation in php super short demo.
<?
// Switch statment + additional eval
ini_set('display_errors',1);
$arr = array(
'match',
'other'
);
x($arr);
function x($a){
switch($a[0]){
// order matters
case 'match' && $a[1]=='other':
echo 'match-other';
break;
case 'match':
echo 'match';
break;
}
}
// match-other
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment