Last active
October 20, 2016 22:29
-
-
Save peterlafferty/39340246bad32f74a6acd55dea3de0ee to your computer and use it in GitHub Desktop.
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
<?php | |
function test($number, $text) | |
{ | |
if (!is_int($number) || is_null($number)) { | |
throw new Exception('invalid argument type $number'); | |
} | |
if (!is_string($text) || is_null($text)) { | |
throw new Exception('invalid argumenti type $string'); | |
} | |
$number = test2($number); | |
return str_repeat($text, $number); | |
} | |
function test2($number) | |
{ | |
if (!is_int($number) || is_null($number)) { | |
throw new Exception('invalid argument type $number'); | |
} | |
return $number * 2; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment