Skip to content

Instantly share code, notes, and snippets.

@peterlafferty
Created October 20, 2016 22:02
Show Gist options
  • Save peterlafferty/ddd1ccedd47f31c35ef19e1740507c54 to your computer and use it in GitHub Desktop.
Save peterlafferty/ddd1ccedd47f31c35ef19e1740507c54 to your computer and use it in GitHub Desktop.
<?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');
}
//do something
return str_repeat($text, $number);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment