Skip to content

Instantly share code, notes, and snippets.

@ThijsFeryn
Created July 14, 2016 14: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 ThijsFeryn/6fe18a8c25475e2a019f7ec281b18357 to your computer and use it in GitHub Desktop.
Save ThijsFeryn/6fe18a8c25475e2a019f7ec281b18357 to your computer and use it in GitHub Desktop.
Coerce string into an integer. No type error thrown despite the type hint.
<?php
function double(int $argument):int {
return $argument*2;
}
var_dump(double("2"));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment