Created
February 22, 2016 09:47
-
-
Save d30jeff/d30e9223a80b992cde67 to your computer and use it in GitHub Desktop.
IT 24 Hours
This file contains hidden or 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
| <?php | |
| function dd($arg) { | |
| die(var_dump($arg)); | |
| } | |
| $getOddAndEven = function($number) { | |
| if (is_numeric($number)) { | |
| $odd = ceil($number / 2); | |
| return [ | |
| 'odd' => (int)$odd, | |
| 'even' => (int)($number - $odd + 1), | |
| ]; | |
| } else { | |
| return false; | |
| } | |
| }; | |
| dd($getOddAndEven(1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment