Last active
May 27, 2016 14:17
-
-
Save deshack/6a4a7594db31d498693d96599e89acc9 to your computer and use it in GitHub Desktop.
PHP7 Type Hinting - see https://gist.github.com/deshack/e63358a8726b7c3e0ba13563e4f9864c for a full collection of examples about PHP5/PHP7 type hinting
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 setValue(string $value) { | |
var_dump($value); | |
} | |
setValue('foo'); | |
// string(3) "foo" | |
setValue([]); | |
// PHP Warning: Uncaught TypeError: Argument 1 passed to setValue() must be of the type string, array given |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment