Skip to content

Instantly share code, notes, and snippets.

@nubeiro
Created November 6, 2015 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nubeiro/48bc2afd2afa0d835a7e to your computer and use it in GitHub Desktop.
Save nubeiro/48bc2afd2afa0d835a7e to your computer and use it in GitHub Desktop.
Testing default scalar type hints.
<?php
function concatStrings(string $a, string $b) {
return $a . ' - ' . $b;
}
function sum(int $a, int $b) {
return $a + $b;
}
echo sum("1000", "110.33") . PHP_EOL;
// output is
// 1110
echo concatStrings(1, 222) . PHP_EOL;
// output is:
// 1 - 222
echo PHP_EOL;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment