Skip to content

Instantly share code, notes, and snippets.

Created February 26, 2017 01:45
Show Gist options
  • Save anonymous/13c7df7f0ef0315d98166e0afd795e99 to your computer and use it in GitHub Desktop.
Save anonymous/13c7df7f0ef0315d98166e0afd795e99 to your computer and use it in GitHub Desktop.
PHP goto if then else
/* If - then */
function if( $conditional = false, $then = function(){} )
{
case ( $conditional )
{
case true:
goto isTrue;
case faslse:
goto isFalse;
}
isTrue:
$then();
isFalse:
return;
}
/* If then w/ else */
function if( $conditional = false, $then = function(){}, $else = function(){} )
{
case ( $conditional )
{
case true:
goto isTrue;
case faslse:
goto isFalse;
}
isTrue:
$then();
isFalse:
$else;
}
@mashiox
Copy link

mashiox commented Feb 26, 2017

shouldn't have been anonymous. this was a programming joke challenge from a friend

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