Why are interfaces unusable in PHP?
Posted
by streetparade
on Stack Overflow
See other posts from Stack Overflow
or by streetparade
Published on 2010-06-15T19:00:37Z
Indexed on
2010/06/15
19:02 UTC
Read the original article
Hit count: 123
I mean an interface definition without defining the return type makes it unusable?
This makes more Clear
Interface run
{
public function getInteger();
}
class MyString implements run
{
public function myNumber()
{
}
public function getInteger()
{
return "Not a number";
}
}
In Java every Interface has a return type like Integer,String,Void
I know that PHP is unfortunately a loosly typed Language but isnt there a Solution for that Problem?
Is it Possible to defining a Interface with a Return type like Integer?
© Stack Overflow or respective owner