Skip to content

Instantly share code, notes, and snippets.

Created Feb 12, 2015
What would you like to do?
Weak typing in PHP
function foo(int $bar) : int {
return $bar * 2;
var_dump( foo(2.5) ); // int(4) and triggers E_NOTICE - great!
// but without E_NOTICE it as bad as:
var_dump( foo((int) 2.5) );
// and this nobody wants…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment