Created
February 26, 2017 01:45
-
-
Save anonymous/13c7df7f0ef0315d98166e0afd795e99 to your computer and use it in GitHub Desktop.
PHP goto if then else
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shouldn't have been anonymous. this was a programming joke challenge from a friend