Last active
August 29, 2015 14:19
-
-
Save jazzdan/9480e83bd48c3c9b95a2 to your computer and use it in GitHub Desktop.
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 add(int $a, int $b): int { | |
myLog($a + $b); | |
return $a + $b; | |
} |
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 | |
declare(strict_types=1); | |
function myLog(string $message): string { | |
return $message; | |
} |
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 | |
require 'add.php'; | |
require 'logger.php'; | |
$result = add(1, 3); | |
echo $result; |
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 main.php | |
4 | |
$ hhvm -vEval.EnableHipHopSyntax=true main.php | |
Catchable fatal error: Argument 1 passed to myLog() must be an instance of string, int given in /home/vagrant/separate_files_mixed/logger.php on line 6 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment