Skip to content

Instantly share code, notes, and snippets.

@deshack
Last active May 27, 2016 14:17
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 deshack/6a4a7594db31d498693d96599e89acc9 to your computer and use it in GitHub Desktop.
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
<?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